]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/forms/form-validators/email.validator.ts
Server: add video language attribute
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-validators / email.validator.ts
CommitLineData
ad4a8a1c
C
1import { FormControl } from '@angular/forms';
2
3export 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}