From df0d81f68cb2a3e7c9824b8b3b6e657e9cdcfcdb Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 15 Feb 2016 22:19:04 +0100 Subject: [PATCH] Fixes #121: Replaced the 'validateEmail' validation with a RFC822 regex expression. --- src/assets/js/general_functions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js index e2199745..9fa6de48 100644 --- a/src/assets/js/general_functions.js +++ b/src/assets/js/general_functions.js @@ -187,13 +187,13 @@ var GeneralFunctions = { * This method validates an email address. If the address is not on the proper * form then the result is FALSE. * - * @link http://stackoverflow.com/a/46181 + * @link http://badsyntax.co/post/javascript-email-validation-rfc822 * * @param {string} email The email address to be checked. * @returns {bool} Returns the validation result. */ validateEmail: function (email) { - var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + var re = /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/; return re.test(email); },