function user_pass_reset_url

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

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

Parameters

\Drupal\user\UserInterface $account: An object containing the user account.

array $options: (optional) A keyed array of settings. Supported options are:

  • langcode: A language code to be used when generating locale-sensitive URLs. If langcode is NULL the users preferred language is used.

Return value

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

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal\user\OneTimeAuthentication::generateOneTimeLoginUrl() instead.

See also

https://www.drupal.org/node/3581062

1 call to user_pass_reset_url()
ServerCommand::getOneTimeLoginUrl in core/lib/Drupal/Core/Command/ServerCommand.php
Gets a one time login URL for user 1.

File

core/modules/user/user.module, line 130

Code

function user_pass_reset_url($account, $options = []) {
  @trigger_error(__METHOD__ . ' is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal\\user\\OneTimeAuthentication::generateOneTimeLoginUrl() instead. See https://www.drupal.org/node/3581062', E_USER_DEPRECATED);
  return \Drupal::service(OneTimeAuthentication::class)->generateOneTimeLoginUrl($account, $options)
    ->toString();
}

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