From abf9f91cabf328aa0332a046cbc26a093cb3153e Mon Sep 17 00:00:00 2001 From: Aditya Bharadwaj Date: Sat, 29 Jul 2017 15:48:21 +0200 Subject: [PATCH 1/3] Added the requirement for pg_trgm extension. If not installed, will cause error during installation. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86979d88..696f851d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ GraphSpace has three dummy users: Requirements =================================== 1. Python v2.7.10 -2. [postgreSQL](https://github.com/Murali-group/GraphSpace/wiki/PostgreSQL-Installation) +2. [postgreSQL](https://github.com/Murali-group/GraphSpace/wiki/PostgreSQL-Installation) with pg_trgm extension 3. virtualenv 4. [bower](https://bower.io/) 5. [ElasticSearch](https://github.com/Murali-group/GraphSpace/wiki/Steps-for-setting-up-ElasticSearch-on-AWS) From 6bef91704697d04e619031bdca9386f2c2ed835f Mon Sep 17 00:00:00 2001 From: YoonjinTKim Date: Fri, 4 Aug 2017 13:48:24 -0400 Subject: [PATCH 2/3] Added a javascript function that checks the validity of the email format from: (https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript) --- static/js/main.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index aefeaf82..e8adc8b8 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -62,9 +62,9 @@ var header = { var password = $("#password").val(); var verify_password = $("#verify_password").val(); - if (!$("#user_id") || user_id.length == 0) { + if (!$("#user_id") || user_id.length == 0 || !validateEmail(user_id)) { $.notify({ - message: 'Please enter your email!' + message: 'Please enter a valid email address!' }, { type: 'warning' }); @@ -115,4 +115,16 @@ var header = { }); }); } -}; \ No newline at end of file +}; + + +/** + * Code from: https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript + * + * Checks the validity of the email format + * Validating the actual address will be needed + */ +function validateEmail(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,}))$/; + return re.test(email); +} \ No newline at end of file From 2aad6cc2d4d6f8c7886871a9a3a80d4c2224bc37 Mon Sep 17 00:00:00 2001 From: YoonjinTKim Date: Sun, 3 Sep 2017 18:06:46 -0400 Subject: [PATCH 3/3] Moved validateEmail(email) into uitls.js library --- static/js/main.js | 10 ---------- static/js/utils.js | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index e8adc8b8..96d63b0a 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -118,13 +118,3 @@ var header = { }; -/** - * Code from: https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript - * - * Checks the validity of the email format - * Validating the actual address will be needed - */ -function validateEmail(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,}))$/; - return re.test(email); -} \ No newline at end of file diff --git a/static/js/utils.js b/static/js/utils.js index 41937f27..c2a704f6 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -324,3 +324,14 @@ UndoManager.prototype = { this.onUpdate(this.state.push(action)); } }; + +/** + * Code from: https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript + * + * Checks the validity of the email format + * Validating the actual address will be needed + */ +function validateEmail(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,}))$/; + return re.test(email); +} \ No newline at end of file