2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
// 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){
// 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'))));