function user_pass_rehash

Creates a unique hash value for use in time-dependent per-user URLs.

This hash is normally used to build a unique and secure URL that is sent to the user by email for purposes such as resetting the user's password. In order to validate the URL, the same hash can be generated again, from the same information, and compared to the hash value from the URL. The URL normally contains both the time stamp and the numeric user ID. The login timestamp and hashed password are retrieved from the database as necessary. For a usage example, see user_cancel_url() and user_cancel_confirm().

Parameters

string $password: The hashed user account password value.

int $timestamp: A UNIX timestamp, typically REQUEST_TIME.

int $login: The UNIX timestamp of the user's last login.

Return value

A string that is safe for use in URLs and SQL statements.

11 calls to user_pass_rehash()
UserCancelTest::testUserAnonymize in drupal/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
Delete account and anonymize all content.
UserCancelTest::testUserBlock in drupal/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
Disable account and keep all content.
UserCancelTest::testUserBlockUnpublish in drupal/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
Disable account and unpublish all content.
UserCancelTest::testUserCancelInvalid in drupal/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
Attempt invalid account cancellations.
UserCancelTest::testUserCancelWithoutPermission in drupal/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
Attempt to cancel account without permission.

... See full list

File

drupal/core/modules/user/user.module, line 1489
Enables the user registration and login system.

Code

function user_pass_rehash($password, $timestamp, $login) {
  return Crypt::hmacBase64($timestamp . $login, drupal_get_hash_salt() . $password);
}