]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: use builtin email validator
authorChocobozzz <florian.bigard@gmail.com>
Sun, 16 Apr 2017 17:52:06 +0000 (19:52 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Wed, 26 Apr 2017 19:22:51 +0000 (21:22 +0200)
client/src/app/shared/forms/form-validators/email.validator.ts [deleted file]
client/src/app/shared/forms/form-validators/index.ts
client/src/app/shared/forms/form-validators/user.ts

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 (file)
index 6a2c3bd..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-import { FormControl } from '@angular/forms';
-
-export function validateEmail(c: FormControl) {
-  // Thanks to http://emailregex.com/
-  /* tslint:disable */
-  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,}))$/;
-
-  return EMAIL_REGEXP.test(c.value) ? null : {
-    email: {
-      valid: false
-    }
-  };
-}
index 669411a54755ce29c54dac9bbd4ed888eccdb983..ab7c2df319441dc18cb76e1dc4b59abed5a19c83 100644 (file)
@@ -1,4 +1,3 @@
-export * from './email.validator';
 export * from './host.validator';
 export * from './user';
 export * from './video-abuse';
index 0ad0e2a4b48900c6f050de41d906c857cd57c55b..259d2b868965f6fb3187d7edbdc0e086886eb7d5 100644 (file)
@@ -1,7 +1,5 @@
 import { Validators } from '@angular/forms';
 
-import { validateEmail } from './email.validator';
-
 export const USER_USERNAME = {
   VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ],
   MESSAGES: {
@@ -11,7 +9,7 @@ export const USER_USERNAME = {
   }
 };
 export const USER_EMAIL = {
-  VALIDATORS: [ Validators.required, validateEmail ],
+  VALIDATORS: [ Validators.required, Validators.email ],
   MESSAGES: {
     'required': 'Email is required.',
     'email': 'Email must be valid.',