summaryrefslogtreecommitdiff
path: root/modules/user/user.pages.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-14 23:01:38 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-14 23:01:38 +0000
commit3b3050959952ceae617b59246f364f4b0edd2dcd (patch)
treeb7cc39b97156ee0f346334d1e8dd78b5662c40e7 /modules/user/user.pages.inc
parent8a0d326a8e134ad4261b9575ce073f9e44b72f60 (diff)
downloadbrdo-3b3050959952ceae617b59246f364f4b0edd2dcd.tar.gz
brdo-3b3050959952ceae617b59246f364f4b0edd2dcd.tar.bz2
#347250 by catch, drewish, and Berdir: Add function for loading multiple users in one request.
Diffstat (limited to 'modules/user/user.pages.inc')
-rw-r--r--modules/user/user.pages.inc9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 581ac683a..f1fb2f42d 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -44,10 +44,12 @@ function user_pass() {
function user_pass_validate($form, &$form_state) {
$name = trim($form_state['values']['name']);
// Try to load by email.
- $account = user_load(array('mail' => $name, 'status' => 1));
+ $users = user_load_multiple(array(), array('mail' => $name, 'status' => '1'));
+ $account = reset($users);
if (!$account) {
// No success, try to load by name.
- $account = user_load(array('name' => $name, 'status' => 1));
+ $users = user_load_multiple(array(), array('name' => $name, 'status' => '1'));
+ $account = reset($users);
}
if (isset($account->uid)) {
form_set_value(array('#parents' => array('account')), $account, $form_state);
@@ -86,7 +88,8 @@ function user_pass_reset(&$form_state, $uid, $timestamp, $hashed_pass, $action =
$timeout = 86400;
$current = REQUEST_TIME;
// Some redundant checks for extra security ?
- if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) {
+ $users = user_load_multiple(array($uid), array('status' => '1'));
+ if ($timestamp < $current && $account = reset($users)) {
// No time out for first time login.
if ($account->login && $current - $timestamp > $timeout) {
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.'));