Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 15 additions & 3 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this validation to forgot password form as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to make separate function for forgot password in main.js and use this method in js file or do you want to implement another checking method for python code? Cause for now, forgot password is under views.py python file.

$.notify({
message: 'Please enter your email!'
message: 'Please enter a valid email address!'
}, {
type: 'warning'
});
Expand Down Expand Up @@ -115,4 +115,16 @@ 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to utils.js library.

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);
}