summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-02-15 20:52:28 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-02-15 20:52:28 +0000
commita76151351e0e00da6b5e7f81fdd009cb44e7eabe (patch)
tree2901529ce30fb98bd2f0be8e3082b5b8bad4a896 /modules
parenta7a323e702f9cd9d082c0a3049fa243f5d3511e5 (diff)
downloadbrdo-a76151351e0e00da6b5e7f81fdd009cb44e7eabe.tar.gz
brdo-a76151351e0e00da6b5e7f81fdd009cb44e7eabe.tar.bz2
- Modifying user_validate_mail() to accept more e-mail addresses.
Diffstat (limited to 'modules')
-rw-r--r--modules/user.module7
-rw-r--r--modules/user/user.module7
2 files changed, 12 insertions, 2 deletions
diff --git a/modules/user.module b/modules/user.module
index cb170f579..6cb02d04e 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -187,7 +187,12 @@ function user_validate_mail($mail) {
** allowed.
*/
- if ($mail && !eregi("^[0-9a-z_\.-]+@(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,})$", $mail)) {
+ $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)) {
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 cb170f579..6cb02d04e 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -187,7 +187,12 @@ function user_validate_mail($mail) {
** allowed.
*/
- if ($mail && !eregi("^[0-9a-z_\.-]+@(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,})$", $mail)) {
+ $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)) {
return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail));
}
}