function user_pass_reset_url

Same name in other branches
  1. 9 core/modules/user/user.module \user_pass_reset_url()
  2. 8.9.x core/modules/user/user.module \user_pass_reset_url()
  3. 10 core/modules/user/user.module \user_pass_reset_url()
  4. 11.x core/modules/user/user.module \user_pass_reset_url()

Generates a unique URL for a user to login and reset their password.

Parameters

object $account: An object containing the user account, which must contain at least the following properties:

  • uid: The user ID number.
  • login: The UNIX timestamp of the user's last login.

Return value

A unique URL that provides a one-time log in for the user, from which they can change their password.

4 calls to user_pass_reset_url()
UserPasswordResetTestCase::generateResetURL in modules/user/user.test
Generates login link.
UserPasswordResetTestCase::testResetImpersonation in modules/user/user.test
Make sure that users cannot forge password reset URLs of other users.
UserPasswordResetTestCase::testResetInvalidation in modules/user/user.test
Make sure that password reset URLs are invalidated when the user's email address changes.
user_mail_tokens in modules/user/user.module
Token callback to add unsafe tokens for user mails.

File

modules/user/user.module, line 2399

Code

function user_pass_reset_url($account) {
    $timestamp = REQUEST_TIME;
    return url("user/reset/{$account->uid}/{$timestamp}/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid, $account->mail), array(
        'absolute' => TRUE,
    ));
}

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