Password policy table do not displays for anonymous user - regression

Created on 4 October 2022, over 1 year ago
Updated 7 April 2024, 3 months 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

Postponed: needs info

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

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 3 months 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.

Production build 0.69.0 2024