diff options
Diffstat (limited to 'client')
3 files changed, 1 insertions, 17 deletions
diff --git a/client/src/app/shared/forms/form-validators/email.validator.ts b/client/src/app/shared/forms/form-validators/email.validator.ts deleted file mode 100644 index 6a2c3bdca..000000000 --- a/client/src/app/shared/forms/form-validators/email.validator.ts +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
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 | } | ||
diff --git a/client/src/app/shared/forms/form-validators/index.ts b/client/src/app/shared/forms/form-validators/index.ts index 669411a54..ab7c2df31 100644 --- a/client/src/app/shared/forms/form-validators/index.ts +++ b/client/src/app/shared/forms/form-validators/index.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | export * from './email.validator'; | ||
2 | export * from './host.validator'; | 1 | export * from './host.validator'; |
3 | export * from './user'; | 2 | export * from './user'; |
4 | export * from './video-abuse'; | 3 | export * from './video-abuse'; |
diff --git a/client/src/app/shared/forms/form-validators/user.ts b/client/src/app/shared/forms/form-validators/user.ts index 0ad0e2a4b..259d2b868 100644 --- a/client/src/app/shared/forms/form-validators/user.ts +++ b/client/src/app/shared/forms/form-validators/user.ts | |||
@@ -1,7 +1,5 @@ | |||
1 | import { Validators } from '@angular/forms'; | 1 | import { Validators } from '@angular/forms'; |
2 | 2 | ||
3 | import { validateEmail } from './email.validator'; | ||
4 | |||
5 | export const USER_USERNAME = { | 3 | export const USER_USERNAME = { |
6 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ], | 4 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ], |
7 | MESSAGES: { | 5 | MESSAGES: { |
@@ -11,7 +9,7 @@ export const USER_USERNAME = { | |||
11 | } | 9 | } |
12 | }; | 10 | }; |
13 | export const USER_EMAIL = { | 11 | export const USER_EMAIL = { |
14 | VALIDATORS: [ Validators.required, validateEmail ], | 12 | VALIDATORS: [ Validators.required, Validators.email ], |
15 | MESSAGES: { | 13 | MESSAGES: { |
16 | 'required': 'Email is required.', | 14 | 'required': 'Email is required.', |
17 | 'email': 'Email must be valid.', | 15 | 'email': 'Email must be valid.', |