From fae1a631244895abc6cc409d8d7f5aac9a140565 Mon Sep 17 00:00:00 2001 From: nikrou Date: Sun, 7 Sep 2008 11:05:15 +0000 Subject: fix too strict regex for email git-svn-id: http://piwigo.org/svn/trunk@2507 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_user.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/functions_user.inc.php') diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index f60a7fe77..6276d37a0 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -41,7 +41,10 @@ function validate_mail_address($user_id, $mail_address) return ''; } - $regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/'; + $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase + $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name + $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; + if ( !preg_match( $regex, $mail_address ) ) { return l10n('reg_err_mail_address'); -- cgit v1.2.3