summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/user/user.pages.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 9262e4271..03bcd0c10 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -43,10 +43,10 @@ function user_pass() {
function user_pass_validate($form, &$form_state) {
$name = trim($form_state['values']['name']);
- if (valid_email_address($name)) {
- $account = user_load(array('mail' => $name, 'status' => 1));
- }
- else {
+ // Try to load by email.
+ $account = user_load(array('mail' => $name, 'status' => 1));
+ if (!$account) {
+ // No success, try to load by name.
$account = user_load(array('name' => $name, 'status' => 1));
}
if (isset($account->uid)) {