summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-01-21 14:37:35 +0000
committerDries Buytaert <dries@buytaert.net>2009-01-21 14:37:35 +0000
commitdaf4acf2bec7324069b1e80071f4a596b8067757 (patch)
tree5974a9f27a72ff901f29f34d9c5d03b354caa379 /modules
parent60c06921ce37fae8604b83e0ccd149f3ee3eab1e (diff)
downloadbrdo-daf4acf2bec7324069b1e80071f4a596b8067757.tar.gz
brdo-daf4acf2bec7324069b1e80071f4a596b8067757.tar.bz2
- Patch #195976 by mcarbone: made error message more accurate and more informative.
Diffstat (limited to 'modules')
-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'))));
+ }
}
}
}