Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -417,12 +417,6 @@ function user_format_name(AccountInterface $account) {
|
|||
function user_template_preprocess_default_variables_alter(&$variables) {
|
||||
$user = \Drupal::currentUser();
|
||||
|
||||
// If this function is called from the installer after Drupal has been
|
||||
// installed then $user will not be set.
|
||||
if (!is_object($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$variables['user'] = clone $user;
|
||||
// Remove password and session IDs, $form_state, since themes should not need nor see them.
|
||||
unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid);
|
||||
|
@ -574,7 +568,7 @@ function user_pass_reset_url($account, $options = array()) {
|
|||
array(
|
||||
'uid' => $account->id(),
|
||||
'timestamp' => $timestamp,
|
||||
'hash' => user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime(), $account->id()),
|
||||
'hash' => user_pass_rehash($account, $timestamp),
|
||||
),
|
||||
array(
|
||||
'absolute' => TRUE,
|
||||
|
@ -587,11 +581,7 @@ function user_pass_reset_url($account, $options = array()) {
|
|||
* Generates a URL to confirm an account cancellation request.
|
||||
*
|
||||
* @param \Drupal\user\UserInterface $account
|
||||
* The user account object, which must contain at least the following
|
||||
* properties:
|
||||
* - uid: The user ID number.
|
||||
* - pass: The hashed user password string.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* The user account object.
|
||||
* @param array $options
|
||||
* (optional) A keyed array of settings. Supported options are:
|
||||
* - langcode: A language code to be used when generating locale-sensitive
|
||||
|
@ -604,14 +594,14 @@ function user_pass_reset_url($account, $options = array()) {
|
|||
* @see user_mail_tokens()
|
||||
* @see \Drupal\user\Controller\UserController::confirmCancel()
|
||||
*/
|
||||
function user_cancel_url($account, $options = array()) {
|
||||
function user_cancel_url(UserInterface $account, $options = array()) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
$langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode();
|
||||
$url_options = array('absolute' => TRUE, 'language' => \Drupal::languageManager()->getLanguage($langcode));
|
||||
return \Drupal::url('user.cancel_confirm', [
|
||||
'user' => $account->id(),
|
||||
'timestamp' => $timestamp,
|
||||
'hashed_pass' => user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime(), $account->id())
|
||||
'hashed_pass' => user_pass_rehash($account, $timestamp)
|
||||
], $url_options);
|
||||
}
|
||||
|
||||
|
@ -621,26 +611,26 @@ function user_cancel_url($account, $options = array()) {
|
|||
* 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.
|
||||
* same information, and compared to the hash value from the URL. The hash
|
||||
* contains the time stamp, the user's last login time, the numeric user ID,
|
||||
* and the user's email address.
|
||||
* For a usage example, see user_cancel_url() and
|
||||
* \Drupal\user\Controller\UserController::confirmCancel().
|
||||
*
|
||||
* @param string $password
|
||||
* The hashed user account password value.
|
||||
* @param \Drupal\user\UserInterface $account
|
||||
* An object containing the user account.
|
||||
* @param int $timestamp
|
||||
* A UNIX timestamp, typically REQUEST_TIME.
|
||||
* @param int $login
|
||||
* The UNIX timestamp of the user's last login.
|
||||
* @param int $uid
|
||||
* The user ID.
|
||||
*
|
||||
* @return string
|
||||
* A string that is safe for use in URLs and SQL statements.
|
||||
*/
|
||||
function user_pass_rehash($password, $timestamp, $login, $uid) {
|
||||
return Crypt::hmacBase64($timestamp . $login . $uid, Settings::getHashSalt() . $password);
|
||||
function user_pass_rehash(UserInterface $account, $timestamp) {
|
||||
$data = $timestamp;
|
||||
$data .= $account->getLastLoginTime();
|
||||
$data .= $account->id();
|
||||
$data .= $account->getEmail();
|
||||
return Crypt::hmacBase64($data, Settings::getHashSalt() . $account->getPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue