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) diff --git a/static/js/main.js b/static/js/main.js index aefeaf82..96d63b0a 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,6 @@ var header = { }); }); } -}; \ 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