-
Notifications
You must be signed in to change notification settings - Fork 76
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
fix: add additional startsWith('@') check when validating domain #487
Conversation
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.
write a script to check whether the current database state is consistent with this change. otherwise, some admins may not be able to save their form.
I've done a check, as of this instance the only malformed emails are testing domains by me and @syan-syan |
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.
lgtm!
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.
suggesting changing the error copy to "You may have duplicate or invalid email domains. Please check that all the domains start with @."
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.
Ok
Problem
This PR adds an additional check for the allowed domains entered by the user to enforce starting with an '@' symbol. This prevents a form admin from adding a complete email address such as
test@example.com
into the allowed domain field.Related to https://github.com/datagovsg/formsg-private/issues/53
Solution
Bug Fixes:
Before & After Screenshots
BEFORE:
![Screenshot 2020-10-19 at 5 26 32 PM](https://user-images.githubusercontent.com/22133008/96426767-3d3bee00-1230-11eb-8842-4fa3b0058715.png)
Allows full email domains
AFTER:
![Screenshot 2020-10-19 at 3 51 58 PM](https://user-images.githubusercontent.com/22133008/96426703-2b5a4b00-1230-11eb-9690-3f5258af59f5.png)
Prevents full email addresses