aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/shared/forms/form-validators/email.validator.ts13
-rw-r--r--client/src/app/shared/forms/form-validators/index.ts1
-rw-r--r--client/src/app/shared/forms/form-validators/user.ts4
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 @@
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}
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 @@
1export * from './email.validator';
2export * from './host.validator'; 1export * from './host.validator';
3export * from './user'; 2export * from './user';
4export * from './video-abuse'; 3export * 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 @@
1import { Validators } from '@angular/forms'; 1import { Validators } from '@angular/forms';
2 2
3import { validateEmail } from './email.validator';
4
5export const USER_USERNAME = { 3export 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};
13export const USER_EMAIL = { 11export 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.',