-
Notifications
You must be signed in to change notification settings - Fork 554
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
Strict validations for signup view #1921
Strict validations for signup view #1921
Conversation
…l in the username field during signup.
…username was enabled in the login tab. An invalid username was thrown for the following sample abc..@xy.com. In login view we shouldn't throw validation error. Email verification is used in other places as well, so I'm not comfortable with updating it at this time.
…mented behind an option flag
@saltukalakus Can you check how this behaves with #1918? We've just implemented a change where, if you're using a custom resolver, we always use the username field which does not perform formatting validation, where they could use either a username or email address. |
Also, could you please convert the PR into a draft until it is time to review. Thanks. |
👋 @stevehobbsdev the PR is ready for review. I have also tested it with connection resolver option along with your PR. It seems to be working well. I didn't notice an issue. |
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.
Looks good, thanks 👍
Changes
Username validation
In signup view if the user enters an email in the username field, we can't detect this and perform a backend call which ends up with a generic error message. This PR adds a client-side check to verify if the email was typed in the username field and shows an error message instead of making the call.
With this PR we see the following screen as an outcome:
Email validation
Current email validation is very basic and doesn't check all the different email patters. For example, following is considered a valid email, but it isn't: abc..@xyz.com
A few notes about the implementation
To ensure backward compatibility, validations are implemented behind a feature flag named signUpFieldsStrictValidation and the flag is disabled by default. The only use case I can think of which might break with this change is the custom DBs with migration option turned off.
While navigating between the login and the signup screen we weren't refreshing the state. This caused the same validation be in effect for the login screen which we don't want. This issue was fixed by updating the state machine during the component mount.
email
{"error":"error in email - email format validation failed: abc..@xyz.com"}
username
{"name":"BadRequestError","code":"missing_property","description":"Email address cannot be used as username.","statusCode":400,"data":{"min":1,"max":40,"errors":["NOT_PASSED"]}}
References
These changes are related to two support tickets.
Testing
Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.
Checklist