-
Notifications
You must be signed in to change notification settings - Fork 70
#597: added email validator to reset form, show hint if the email isn… #637
#597: added email validator to reset form, show hint if the email isn… #637
Conversation
…'t validated correctly
@@ -80,7 +85,7 @@ export class ResetComponent implements OnInit { | |||
this.resetForm = this.formBuilder.group({}); | |||
} else { | |||
this.resetForm = this.formBuilder.group({ | |||
email: ['', Validators.required] | |||
email: ['', Validators.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.
The Validation does work properly. A email with without "@" does throw a error. A email with missing domain ending, like ".de", will accept. This should also fail.
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.
An email can still be valid without a top level domain: see https://en.wikipedia.org/wiki/Email_address#Examples
But if it really is required to only support emails with tld, we would need to write a custom validator and couldn't use the default angular email validator
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.
@lukas-schardt interesting fact, didn't know that, but it is prohibited to used those since 2013, so would propose using a custom validator.
…hat have only a tld/don't have a tld
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.
Sofar it does look good, only the source is missing.
*/ | ||
export function emailValidator(formControl: FormControl) { | ||
// tslint:disable-next-line:max-line-length | ||
const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\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,}))$/; |
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.
Please Add the link to the source!
…'t validated correctly
Description:
Closes #597
Improvements
Known Issues:
NONE
Remember to prefix your PR-Title with
⚠ WIP:
if you still work on it.If you have reached a final state, remove the prefix.