diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/user.module | 12 | ||||
-rw-r--r-- | modules/user/user.module | 12 |
2 files changed, 2 insertions, 22 deletions
diff --git a/modules/user.module b/modules/user.module index 8dd81ae35..c656e683d 100644 --- a/modules/user.module +++ b/modules/user.module @@ -182,17 +182,7 @@ function user_validate_name($name) { function user_validate_mail($mail) { - /* - ** Verify the syntax of the given e-mail address. Empty e-mail addresses - ** allowed. See RFC 2822 for details. - */ - - $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; - $domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+'; - $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; - $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; - - if ($mail && !preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail)) { + if ($mail && !validate_email_address($mail)) { return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail)); } } diff --git a/modules/user/user.module b/modules/user/user.module index 8dd81ae35..c656e683d 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -182,17 +182,7 @@ function user_validate_name($name) { function user_validate_mail($mail) { - /* - ** Verify the syntax of the given e-mail address. Empty e-mail addresses - ** allowed. See RFC 2822 for details. - */ - - $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; - $domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+'; - $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; - $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; - - if ($mail && !preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail)) { + if ($mail && !validate_email_address($mail)) { return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail)); } } |