Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

#597: added email validator to reset form, show hint if the email isn… #637

Merged
merged 5 commits into from
Apr 19, 2018

Conversation

lukas-schardt
Copy link
Collaborator

…'t validated correctly

Description:

Closes #597

Improvements

  • Passwort reset validates

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.

@coveralls
Copy link

coveralls commented Apr 18, 2018

Coverage Status

Coverage remained the same at 64.279% when pulling 9c9e9a4 on bugfix/#597-validate-password-reset-email into 736c73d on develop.

@lukas-schardt lukas-schardt changed the title ⚠ WIP: #597: added email validator to reset form, show hint if the email isn… #597: added email validator to reset form, show hint if the email isn… Apr 18, 2018
@@ -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 ]
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

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.

Copy link
Collaborator

@PatrickSkowronek PatrickSkowronek left a 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,}))$/;
Copy link
Collaborator

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!

@PatrickSkowronek PatrickSkowronek merged commit 7a0f180 into develop Apr 19, 2018
@PatrickSkowronek PatrickSkowronek deleted the bugfix/#597-validate-password-reset-email branch April 19, 2018 08:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 BUG: Validate password reset email
3 participants