diff options
-rw-r--r-- | modules/user.module | 6 | ||||
-rw-r--r-- | modules/user/user.module | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/modules/user.module b/modules/user.module index 405607a7b..e91ba37e6 100644 --- a/modules/user.module +++ b/modules/user.module @@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { function user_authenticate($name, $pass) { global $user; - // Try to log in the user locally: - $user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); + // Try to log in the user locally. Don't set $user unless successful. + if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) { + $user = $account; + }; // Strip name and server from ID: if ($server = strrchr($name, '@')) { diff --git a/modules/user/user.module b/modules/user/user.module index 405607a7b..e91ba37e6 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { function user_authenticate($name, $pass) { global $user; - // Try to log in the user locally: - $user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); + // Try to log in the user locally. Don't set $user unless successful. + if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) { + $user = $account; + }; // Strip name and server from ID: if ($server = strrchr($name, '@')) { |