Password policy table do not displays for anonymous user - regression

Created on 4 October 2022, over 2 years ago
Updated 19 January 2023, about 2 years ago

Problem/Motivation

After install latest update with #2849271: Decouple display of policy table and policy validation β†’ , Password policy table do not displays for anonymous user.

Before update:

function _password_policy_show_policy(array $context = []) {
  $account = \Drupal::currentUser();
  $config = \Drupal::config('user.settings');
  $show_password_policy_status = TRUE;

  if ($account->isAnonymous() and $config->get('verify_mail')) {
    $show_password_policy_status = FALSE;
  }

  Drupal::moduleHandler()
    ->alter('password_policy_show_policy', $show_password_policy_status, $context);
  return $show_password_policy_status;
}

After update:

public function tableShouldBeVisible() {
    if ($this->currentUser->isAnonymous() && $this->userSettingsConfig->get('verify_mail')) {
      return FALSE;
    }

    $role_applies = $this->passwordPolicyStorage->getQuery()
      ->condition('roles.*', $this->currentUser->getRoles(), 'IN')
      ->condition('show_policy_table', TRUE)
      ->execute();
    return !empty($role_applies);
  }

So right now you can not alter this because hook has been removed, additional you can not setup this for anonymous user because this role does not exists in configuration form.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland lamp5 Rzeszow

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Thanks to everyone for the work on this issue.

    I'm going through all the 8.x issues.

    As the 8.x is no longer supported, I'm postponing this issue for now and need feedback as to whether or not this issue is relevant to 4.0.x.

    If it is, please reopen and change the version, make sure the issue summary is clear and complete, including steps to reproduce, and reroll the patch. If it's not, please close.

    If there is no response to this in a month addressing the above, it can be closed.

  • Status changed to Active 6 months ago
  • πŸ‡―πŸ‡΄Jordan Anas_maw

    Yes, it's related to 4.x, we are on 4.0.3 and we are facing the same issue

  • πŸ‡©πŸ‡ͺGermany markdc Hamburg

    Adding related issues for this.

    For 2968052 see #16 ✨ Replace core password suggestions and evaluate constrains in real time Postponed: needs info .

  • πŸ‡©πŸ‡ͺGermany markdc Hamburg

    I got it working.

    I was also not seeing a box for anonymous. While testing, I deselected authenticated role and saved the config form. Cleared cache. Now the anonymous role is in the configuration form. Selected, saved, and I see the table on the user registration form. Yay.

  • πŸ‡«πŸ‡·France damien laguerre

    damien laguerre β†’ made their first commit to this issue’s fork.

  • πŸ‡«πŸ‡·France damien laguerre

    I created an MR with patch #4.
    I've also modified the tableShouldBeVisible and validationShouldRun methods because the table isn't displayed but the rules aren't applied either.

    I haven't found the reason for these tests:

    
        if ($this->currentUser->isAnonymous() && $this->userSettingsConfig->get('verify_mail') && $this->routeMatch->getRouteName() !== 'user.reset') {
          return FALSE;
        }
    
    
  • Pipeline finished with Failed
    27 days ago
    Total: 522s
    #448240
Production build 0.71.5 2024