drupal core updated to 7.28
This commit is contained in:
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
; Information added by Drupal.org packaging script on 2014-05-08
|
||||
version = "7.28"
|
||||
project = "drupal"
|
||||
datestamp = "1375928238"
|
||||
datestamp = "1399522731"
|
||||
|
||||
|
@@ -9,8 +9,8 @@ required = TRUE
|
||||
configure = admin/config/people
|
||||
stylesheets[all][] = user.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
; Information added by Drupal.org packaging script on 2014-05-08
|
||||
version = "7.28"
|
||||
project = "drupal"
|
||||
datestamp = "1375928238"
|
||||
datestamp = "1399522731"
|
||||
|
||||
|
@@ -717,10 +717,14 @@ function user_password($length = 10) {
|
||||
|
||||
// Loop the number of times specified by $length.
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
do {
|
||||
// Find a secure random number within the range needed.
|
||||
$index = ord(drupal_random_bytes(1));
|
||||
} while ($index > $len);
|
||||
|
||||
// Each iteration, pick a random character from the
|
||||
// allowable string and append it to the password:
|
||||
$pass .= $allowable_characters[mt_rand(0, $len)];
|
||||
$pass .= $allowable_characters[$index];
|
||||
}
|
||||
|
||||
return $pass;
|
||||
@@ -733,8 +737,9 @@ function user_password($length = 10) {
|
||||
* An array whose keys are the role IDs of interest, such as $user->roles.
|
||||
*
|
||||
* @return
|
||||
* An array indexed by role ID. Each value is an array whose keys are the
|
||||
* permission strings for the given role ID.
|
||||
* If $roles is a non-empty array, an array indexed by role ID is returned.
|
||||
* Each value is an array whose keys are the permission strings for the given
|
||||
* role ID. If $roles is empty nothing is returned.
|
||||
*/
|
||||
function user_role_permissions($roles = array()) {
|
||||
$cache = &drupal_static(__FUNCTION__, array());
|
||||
@@ -1728,14 +1733,14 @@ function user_menu() {
|
||||
|
||||
// Administration pages.
|
||||
$items['admin/config/people'] = array(
|
||||
'title' => 'People',
|
||||
'description' => 'Configure user accounts.',
|
||||
'position' => 'left',
|
||||
'weight' => -20,
|
||||
'page callback' => 'system_admin_menu_block_page',
|
||||
'access arguments' => array('access administration pages'),
|
||||
'file' => 'system.admin.inc',
|
||||
'file path' => drupal_get_path('module', 'system'),
|
||||
'title' => 'People',
|
||||
'description' => 'Configure user accounts.',
|
||||
'position' => 'left',
|
||||
'weight' => -20,
|
||||
'page callback' => 'system_admin_menu_block_page',
|
||||
'access arguments' => array('access administration pages'),
|
||||
'file' => 'system.admin.inc',
|
||||
'file path' => drupal_get_path('module', 'system'),
|
||||
);
|
||||
$items['admin/config/people/accounts'] = array(
|
||||
'title' => 'Account settings',
|
||||
@@ -2118,7 +2123,7 @@ function user_login_default_validators() {
|
||||
* A FAPI validate handler. Sets an error if supplied username has been blocked.
|
||||
*/
|
||||
function user_login_name_validate($form, &$form_state) {
|
||||
if (isset($form_state['values']['name']) && user_is_blocked($form_state['values']['name'])) {
|
||||
if (!empty($form_state['values']['name']) && user_is_blocked($form_state['values']['name'])) {
|
||||
// Blocked in user administration.
|
||||
form_set_error('name', t('The username %name has not been activated or is blocked.', array('%name' => $form_state['values']['name'])));
|
||||
}
|
||||
@@ -2314,27 +2319,18 @@ function user_external_login_register($name, $module) {
|
||||
* Generates a unique URL for a user to login and reset their password.
|
||||
*
|
||||
* @param object $account
|
||||
* An object containing the user account.
|
||||
* @param 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.
|
||||
* 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
|
||||
* A unique URL that provides a one-time log in for the user, from which
|
||||
* they can change their password.
|
||||
*/
|
||||
function user_pass_reset_url($account, $options = array()) {
|
||||
function user_pass_reset_url($account) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2343,13 +2339,9 @@ function user_pass_reset_url($account, $options = array()) {
|
||||
* @param object $account
|
||||
* The user account object, which must contain at least the following
|
||||
* properties:
|
||||
* - uid: The user uid number.
|
||||
* - uid: The user ID number.
|
||||
* - pass: The hashed user password string.
|
||||
* - login: The user login name.
|
||||
* @param 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.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that may be used to confirm the cancellation of the user
|
||||
@@ -2358,17 +2350,9 @@ function user_pass_reset_url($account, $options = array()) {
|
||||
* @see user_mail_tokens()
|
||||
* @see user_cancel_confirm()
|
||||
*/
|
||||
function user_cancel_url($account, $options = array()) {
|
||||
function user_cancel_url($account) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2379,15 +2363,15 @@ function user_cancel_url($account, $options = array()) {
|
||||
* 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
|
||||
* name and hashed password are retrieved from the database as necessary. For a
|
||||
* usage example, see user_cancel_url() and user_cancel_confirm().
|
||||
* timestamp and hashed password are retrieved from the database as necessary.
|
||||
* For a usage example, see user_cancel_url() and user_cancel_confirm().
|
||||
*
|
||||
* @param $password
|
||||
* @param string $password
|
||||
* The hashed user account password value.
|
||||
* @param $timestamp
|
||||
* A unix timestamp.
|
||||
* @param $login
|
||||
* The user account login name.
|
||||
* @param int $timestamp
|
||||
* A UNIX timestamp, typically REQUEST_TIME.
|
||||
* @param int $login
|
||||
* The UNIX timestamp of the user's last login.
|
||||
*
|
||||
* @return
|
||||
* A string that is safe for use in URLs and SQL statements.
|
||||
@@ -2838,7 +2822,7 @@ Your account on [site:name] has been canceled.
|
||||
if ($replace) {
|
||||
// We do not sanitize the token replacement, since the output of this
|
||||
// replacement is intended for an e-mail message, not a web browser.
|
||||
return token_replace($text, $variables, array('langcode' => $langcode, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
}
|
||||
|
||||
return $text;
|
||||
@@ -2858,15 +2842,15 @@ Your account on [site:name] has been canceled.
|
||||
* An associative array of token replacement values. If the 'user' element
|
||||
* exists, it must contain a user account object with the following
|
||||
* properties:
|
||||
* - login: The account login name.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* - pass: The hashed account login password.
|
||||
* @param $options
|
||||
* Unused parameter required by the token_replace() function.
|
||||
*/
|
||||
function user_mail_tokens(&$replacements, $data, $options) {
|
||||
if (isset($data['user'])) {
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user']);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3694,7 +3678,14 @@ function user_action_info() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks the current user.
|
||||
* Blocks a specific user or the current user, if one is not specified.
|
||||
*
|
||||
* @param $entity
|
||||
* (optional) An entity object; if it is provided and it has a uid property,
|
||||
* the user with that ID is blocked.
|
||||
* @param $context
|
||||
* (optional) An associative array; if no user ID is found in $entity, the
|
||||
* 'uid' element of this array determines the user to block.
|
||||
*
|
||||
* @ingroup actions
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -137,7 +137,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
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)));
|
||||
}
|
||||
@@ -159,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,14 +535,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;
|
||||
|
@@ -2066,26 +2066,6 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp('locale');
|
||||
|
||||
$account = $this->drupalCreateUser(array('access administration pages', 'administer languages'));
|
||||
$this->drupalLogin($account);
|
||||
|
||||
// Add language.
|
||||
$edit = array('langcode' => 'de');
|
||||
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
|
||||
// Enable URL language detection and selection.
|
||||
$edit = array('language[enabled][locale-url]' => 1);
|
||||
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
|
||||
|
||||
// Reset static caching.
|
||||
drupal_static_reset('language_list');
|
||||
drupal_static_reset('locale_url_outbound_alter');
|
||||
drupal_static_reset('locale_language_url_rewrite_url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a user, then tests the tokens generated from it.
|
||||
*/
|
||||
@@ -2136,39 +2116,6 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
|
||||
$output = token_replace($input, array('user' => $account), array('language' => $language, 'sanitize' => FALSE));
|
||||
$this->assertEqual($output, $expected, format_string('Unsanitized user token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
|
||||
$languages = language_list();
|
||||
|
||||
// Generate login and cancel link.
|
||||
$tests = array();
|
||||
$tests['[user:one-time-login-url]'] = user_pass_reset_url($account);
|
||||
$tests['[user:cancel-url]'] = user_cancel_url($account);
|
||||
|
||||
// Generate tokens with interface language.
|
||||
$link = url('user', array('absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('user' => $account), array('langcode' => $language->language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, 'Generated URL is in interface language.');
|
||||
}
|
||||
|
||||
// Generate tokens with the user's preferred language.
|
||||
$edit['language'] = 'de';
|
||||
$account = user_save($account, $edit);
|
||||
$link = url('user', array('language' => $languages[$account->language], 'absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('user' => $account), array('callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, "Generated URL is in the user's preferred language.");
|
||||
}
|
||||
|
||||
// Generate tokens with one specific language.
|
||||
$link = url('user', array('language' => $languages['de'], 'absolute' => TRUE));
|
||||
foreach ($tests as $input => $expected) {
|
||||
foreach (array($user1, $user2) as $account) {
|
||||
$output = token_replace($input, array('user' => $account), array('langcode' => 'de', 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
$this->assertTrue(strpos($output, $link) === 0, "Generated URL in in the requested language.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user