summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-23 20:08:37 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-23 20:15:05 +0200
commitf05a666a3cf52b85d9deac9dc2cb1db2f8f0541f (patch)
treec6d42a0d38ec3d41909189da270c4ef1b6d45c62 /program
parent0a1eda9aff818f25dd80282fc12a4096ce5fcd6a (diff)
Fix email address validation for addresses with IP address in domain part
Diffstat (limited to 'program')
-rw-r--r--program/js/common.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/program/js/common.js b/program/js/common.js
index 863ca4759..723d9da18 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -490,12 +490,13 @@ function rcube_check_email(input, inline)
atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+',
quoted_pair = '\\x5c[\\x00-\\x7f]',
quoted_string = '\\x22('+qtext+'|'+quoted_pair+')*\\x22',
+ ip_addr = '\\[*(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}\\]*',
// Use simplified domain matching, because we need to allow Unicode characters here
// So, e-mail address should be validated also on server side after idn_to_ascii() use
//domain_literal = '\\x5b('+dtext+'|'+quoted_pair+')*\\x5d',
//sub_domain = '('+atom+'|'+domain_literal+')',
// allow punycode/unicode top-level domain
- domain = '([^@\\x2e]+\\x2e)+([^\\x00-\\x40\\x5b-\\x60\\x7b-\\x7f]{2,}|xn--[a-z0-9]{2,})',
+ domain = '(('+ip_addr+')|(([^@\\x2e]+\\x2e)+([^\\x00-\\x40\\x5b-\\x60\\x7b-\\x7f]{2,}|xn--[a-z0-9]{2,})))',
// ICANN e-mail test (http://idn.icann.org/E-mail_test)
icann_domains = [
'\\u0645\\u062b\\u0627\\u0644\\x2e\\u0625\\u062e\\u062a\\u0628\\u0627\\u0631',
@@ -523,7 +524,6 @@ function rcube_check_email(input, inline)
return false;
};
-
// recursively copy an object
function rcube_clone_object(obj)
{