From a6e7e9c104f718a98c92770a1d606b3531b54e3d Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Fri, 14 Jan 2005 15:15:19 +0000
Subject: [PATCH] - Patch #15566 by drumm: must specify a userneme or password
 error happens when it shouldn't.

---
 modules/user.module      | 6 +++---
 modules/user/user.module | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/user.module b/modules/user.module
index d20881dd64af..3807c070f4b3 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -914,9 +914,6 @@ function user_pass() {
   else if ($edit['mail'] && !($account = user_load(array('mail' => $edit['mail'], 'status' => 1)))) {
     form_set_error('mail', t('Sorry. The e-mail address %email is not recognized.', array('%email' => '<em>'. $edit['mail'] .'</em>')));
   }
-  else if ($edit) {
-    drupal_set_message(t('You must provider either a username or e-mail address.'), 'error');
-  }
   if ($account) {
     $from = variable_get('site_mail', ini_get('sendmail_from'));
     $pass = user_password();
@@ -942,6 +939,9 @@ function user_pass() {
     drupal_goto('user');
   }
   else {
+    if ($edit) {
+      drupal_set_message(t('You must provider either a username or e-mail address.'), 'error');
+    }
     // Display form:
     $output = '<p>'. t('Enter your username <strong><em>or</em></strong> your e-mail address.') .'</p>';
     $output .= form_textfield(t('Username'), 'name', $edit['name'], 30, 64);
diff --git a/modules/user/user.module b/modules/user/user.module
index d20881dd64af..3807c070f4b3 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -914,9 +914,6 @@ function user_pass() {
   else if ($edit['mail'] && !($account = user_load(array('mail' => $edit['mail'], 'status' => 1)))) {
     form_set_error('mail', t('Sorry. The e-mail address %email is not recognized.', array('%email' => '<em>'. $edit['mail'] .'</em>')));
   }
-  else if ($edit) {
-    drupal_set_message(t('You must provider either a username or e-mail address.'), 'error');
-  }
   if ($account) {
     $from = variable_get('site_mail', ini_get('sendmail_from'));
     $pass = user_password();
@@ -942,6 +939,9 @@ function user_pass() {
     drupal_goto('user');
   }
   else {
+    if ($edit) {
+      drupal_set_message(t('You must provider either a username or e-mail address.'), 'error');
+    }
     // Display form:
     $output = '<p>'. t('Enter your username <strong><em>or</em></strong> your e-mail address.') .'</p>';
     $output .= form_textfield(t('Username'), 'name', $edit['name'], 30, 64);
-- 
GitLab