summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-24 10:10:25 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-24 10:14:47 +0200
commitb7e5ac05da39d35f9f8c73edc46ece3fe91ff411 (patch)
tree9f9c592db209d3142746f832a3f0fa807515f48d /program
parentf05a666a3cf52b85d9deac9dc2cb1db2f8f0541f (diff)
Improved email address validation with IPv6 support
Conflicts: program/include/rcube_utils.php tests/Utils.php
Diffstat (limited to 'program')
-rw-r--r--program/js/common.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/program/js/common.js b/program/js/common.js
index 723d9da18..a07cc8cab 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -490,7 +490,9 @@ 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}\\]*',
+ ipv4 = '\\[(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}\\]',
+ ipv6 = '\\[IPv6:[0-9a-f:.]+\\]',
+ ip_addr = '(' + ipv4 + ')|(' + ipv6 + ')',
// 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',