summaryrefslogtreecommitdiff
path: root/program/js/common.js
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:10:25 +0200
commitda28121dcd160045c468b7028ee835b24f0cb965 (patch)
tree758e80ee6c50d7566f7cac3df3265563dd18d2d9 /program/js/common.js
parenta05bcd4926642607d259bae97250a852580eb3ea (diff)
Improved email address validation with IPv6 support
Diffstat (limited to 'program/js/common.js')
-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 2d8d9e176..f9e945c05 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -494,7 +494,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',