aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-16 19:52:06 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-26 21:22:51 +0200
commitc689fcdca23e8693b6b6386fff779f9330f7f1c4 (patch)
treefbce6c0bd19ddde432a46529625a94246c022bc5 /client
parent16a31eb74177f2eefe9dbca010ea573d23373291 (diff)
downloadPeerTube-c689fcdca23e8693b6b6386fff779f9330f7f1c4.tar.gz
PeerTube-c689fcdca23e8693b6b6386fff779f9330f7f1c4.tar.zst
PeerTube-c689fcdca23e8693b6b6386fff779f9330f7f1c4.zip
Client: use builtin email validator
Diffstat (limited to 'client')
-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.',