summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/user/user.module10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 506c5d28e..8f8f66746 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -749,12 +749,18 @@ function user_user_validate(&$edit, &$account, $category = NULL) {
}
}
- // Validate the e-mail address:
+ // Validate the e-mail address, and check if it is taken by an existing user.
if ($error = user_validate_mail($edit['mail'])) {
form_set_error('mail', $error);
}
elseif (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
- form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $edit['mail'], '@password' => url('user/password'))));
+ // Format error message dependent on whether the user is logged in or not.
+ if ($GLOBALS['user']->uid) {
+ form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $edit['mail'])));
+ }
+ else {
+ form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $edit['mail'], '@password' => url('user/password'))));
+ }
}
}
}