security update core+modules
This commit is contained in:
@@ -36,6 +36,7 @@ function user_pass() {
|
||||
'#size' => 60,
|
||||
'#maxlength' => max(USERNAME_MAX_LENGTH, EMAIL_MAX_LENGTH),
|
||||
'#required' => TRUE,
|
||||
'#default_value' => isset($_GET['name']) ? $_GET['name'] : '',
|
||||
);
|
||||
// Allow logged in users to request this also.
|
||||
if ($user->uid > 0) {
|
||||
@@ -125,18 +126,18 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
|
||||
drupal_goto('user/password');
|
||||
}
|
||||
elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
|
||||
elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid)) {
|
||||
// First stage is a confirmation form, then login
|
||||
if ($action == 'login') {
|
||||
watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
|
||||
// Set the new user.
|
||||
$user = $account;
|
||||
// user_login_finalize() also updates the login timestamp of the
|
||||
// user, which invalidates further use of the one-time login link.
|
||||
user_login_finalize();
|
||||
watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
|
||||
drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
|
||||
// Let the user's password be changed without the current password check.
|
||||
$token = drupal_hash_base64(drupal_random_bytes(55));
|
||||
$token = drupal_random_key();
|
||||
$_SESSION['pass_reset_' . $user->uid] = $token;
|
||||
drupal_goto('user/' . $user->uid . '/edit', array('query' => array('pass-reset-token' => $token)));
|
||||
}
|
||||
@@ -158,6 +159,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
// Deny access, no more clues.
|
||||
// Everything will be in the watchdog's URL for the administrator to check.
|
||||
drupal_access_denied();
|
||||
drupal_exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,8 +183,11 @@ function user_logout() {
|
||||
/**
|
||||
* Process variables for user-profile.tpl.php.
|
||||
*
|
||||
* The $variables array contains the following arguments:
|
||||
* - $account
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - elements: An associative array containing the user information and any
|
||||
* fields attached to the user. Properties used:
|
||||
* - #account: The user account of the profile being viewed.
|
||||
*
|
||||
* @see user-profile.tpl.php
|
||||
*/
|
||||
@@ -354,7 +359,6 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
|
||||
$form['_account'] = array('#type' => 'value', '#value' => $account);
|
||||
|
||||
// Display account cancellation method selection, if allowed.
|
||||
$default_method = variable_get('user_cancel_method', 'user_cancel_block');
|
||||
$admin_access = user_access('administer users');
|
||||
$can_select_method = $admin_access || user_access('select account cancellation method');
|
||||
$form['user_cancel_method'] = array(
|
||||
@@ -518,7 +522,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
|
||||
// Basic validation of arguments.
|
||||
if (isset($account->data['user_cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) {
|
||||
// Validate expiration and hashed password/login.
|
||||
if ($timestamp <= $current && $current - $timestamp < $timeout && $account->uid && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
|
||||
if ($timestamp <= $current && $current - $timestamp < $timeout && $account->uid && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid)) {
|
||||
$edit = array(
|
||||
'user_cancel_notify' => isset($account->data['user_cancel_notify']) ? $account->data['user_cancel_notify'] : variable_get('user_mail_status_canceled_notify', FALSE),
|
||||
);
|
||||
@@ -533,14 +537,20 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
|
||||
drupal_goto("user/$account->uid/cancel");
|
||||
}
|
||||
}
|
||||
drupal_access_denied();
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access callback for path /user.
|
||||
* Page callback: Displays the user page.
|
||||
*
|
||||
* Displays user profile if user is logged in, or login form for anonymous
|
||||
* users.
|
||||
*
|
||||
* @return
|
||||
* A render array for either a user profile or a login form.
|
||||
*
|
||||
* @see user_view_page()
|
||||
* @see user_login()
|
||||
*/
|
||||
function user_page() {
|
||||
global $user;
|
||||
|
||||
Reference in New Issue
Block a user