-
Notifications
You must be signed in to change notification settings - Fork 58
Added regex based email validation #152
base: develop
Are you sure you want to change the base?
Added regex based email validation #152
Conversation
@KevalPrajapati Just to keep the clone clean, could you use a library from pub.dev to validate? Also can you add a alert message below the textfield itself once the user finishes editing the email textfield |
I was thinking to do the same. But as the app earlier didn't work like that so didn't do that. |
Also @techno-disaster Do we need a password validator? If yes then what are the conditions? We need to know what passwords are valid in backend. |
afaik we already have some validation on the backend. But it would be nice if users are given this warning as before they hit the signup button {'message': 'The username field has to be longer than 5 characters and shorter than 25 characters.'} |
Are you sure we should use a library for this? I have anyways implemented the code with library.. But I thought should we depend on a library for this or not. |
imho yes, the code looks cleaner and sometimes it is possible that we miss some regex. Another subtle point could be libraries update and we won't have to update our manually written regex everytime we found iut something is missing in it. The email_validator library on pub has the most correct implementation afaik. @isabelcosta what do you think about this? |
For the alert message every field would need form of itself. Should I do that? |
Can you explain what you mean by form of itself? |
So when you click the submit button, the form is first being validated and then the registration process is being done. So if we want to validate individual fields when user inputs something in it, we would need to put every field in a unique form so when the user inputs some thing in it, the form can be validated. Currently I am traveling so tomorrow I will show you the code. |
@techno-disaster I have implemented email_validator library and added alert messages. |
} | ||
|
||
String _validateConfirmPassword(String value) { | ||
if (value.toString() != _passwordController.text) { |
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.
@KevalPrajapati Can you remove tge #153 parts ? Lets keep it open for first timers for now
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.
Done.
@techno-disaster sorry for rushing a bit. But could you check the updated pr please. |
LGTM, thank you for contributing to mentorship flutter |
Description
Added regex email validation.
Fixes #149
Flutter Channel:
Type of Change:
Delete irrelevant options.
Code/Quality Assurance Only
How Has This Been Tested?
The following cases are tested
*Following are invalid cases
invalid email

valid email

Checklist:
Delete irrelevant options.
Code/Quality Assurance Only