Commit daf4acf2 authored by Dries's avatar Dries

- Patch #195976 by mcarbone: made error message more accurate and more informative.

parent 60c06921
......@@ -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'))));
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment