1 user.api.php hook_user_password_reject_weak_alter(&$reject_weak, $account)

Alter the requirement for rejecting weak passwords.

Called by user_password_reject_weak() to allow modules to alter whether to reject weak passwords. Can be used to only reject passwords for certain roles. For instance, administrators may be required to set strong passwords.

Parameters

bool $reject_weak: Reject or allow weak passwords.

$account: The account object passed from user_password_reject_password().

See also

user_password_reject_password()

Related topics

File

core/modules/user/user.api.php, line 446
Hooks provided by the User module.

Code

function hook_user_password_reject_weak_alter(&$reject_weak, $account) {
  if (in_array('administrator', $account->roles)) {
    $reject_weak = TRUE;
  }
}