]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/forms/form-validators/email.validator.ts
Relax on tags (accept any characters and not required anymore)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-validators / email.validator.ts
1 import { FormControl } from '@angular/forms';
2
3 export function validateEmail(c: FormControl) {
4 // Thanks to http://emailregex.com/
5 /* tslint:disable */
6 const EMAIL_REGEXP = /^(([^<>()\[\]\\.,;:\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,}))$/;
7
8 return EMAIL_REGEXP.test(c.value) ? null : {
9 email: {
10 valid: false
11 }
12 };
13 }