-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #297 Registration asks for an email address but does not validate the field properly #303
base: develop
Are you sure you want to change the base?
Conversation
If not installed, will cause error during installation.
Should it be validating the user_id, or the password field? |
validateEmail() is used for user_id field |
Oh, yeah, whoops. Sorry, not sure what I was thinking there... Note that this fix in and of itself will not complete the issue: there are at least two cases in the code where the size of the email (user ID) form is hard-coded to only accept what might be unacceptably-short emails. These include the registration/login form, and the forgotten password form. We should probably incorporate those changes into this request as well. The Python model does not appear to need a change, however. |
static/js/main.js
Outdated
* Validating the actual address will be needed | ||
*/ | ||
function validateEmail(email) { |
There was a problem hiding this comment.
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.
@@ -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)) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Added a javascript function validateEmail(String) from: https://stackoverflow.com/a/46181
The function checks the validity of the email format in the registration process. The demo of the function is available in the link above.
However, this function only checks the format of the email, so the validity of the email should be checked on the server side. This issue relates to #298 when the user wants to reset the password through the email address.