function PhpPassword::needsRehash

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Password/PhpPassword.php \Drupal\Core\Password\PhpPassword::needsRehash()

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

This is typically called during the login process in order to trigger the rehashing of the password, as in that stage, the plain text password is available.

This method returns TRUE if the password was hashed with an older algorithm.

Parameters

string|null $hash: The hash to be checked.

Return value

bool TRUE if the hash is outdated and needs rehash.

Overrides PasswordInterface::needsRehash

File

core/lib/Drupal/Core/Password/PhpPassword.php, line 59

Class

PhpPassword
Secure PHP password hashing functions.

Namespace

Drupal\Core\Password

Code

public function needsRehash(#[\SensitiveParameter] $hash) {
  return password_needs_rehash($hash, $this->algorithm, $this->options);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.