You are here

public function MigratePassword::needsRehash in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/MigratePassword.php \Drupal\user\MigratePassword::needsRehash()

Check whether a hashed password needs to be replaced with a new hash.

This is typically called during the login process when the plain text password is available. A new hash is needed when the desired iteration count has changed by a modification of the password-service in the dependency injection container or if the user's password hash was generated in an update like user_update_7000() (see the Drupal 7 documentation).

Parameters

string $hash: The existing hash to be checked.

Return value

bool TRUE if the hash is outdated and needs rehash.

Overrides PasswordInterface::needsRehash

File

core/modules/user/src/MigratePassword.php, line 51
Contains \Drupal\user\MigratePassword.

Class

MigratePassword
Replaces the original 'password' service in order to prefix the MD5 re-hashed passwords with the 'U' flag. The new salted hash is recreated on first login similarly to the D6->D7 upgrade path.

Namespace

Drupal\user

Code

public function needsRehash($hash) {
  return $this->originalPassword
    ->needsRehash($hash);
}