]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/form-validators/user-validators.ts
Refactor actor avatar display
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / form-validators / user-validators.ts
index 9efc5180d69300087e4b9e4dbeda5dba3636a1b3..fee37e95f1e35a53755af18ca307d2677f63623f 100644 (file)
@@ -39,6 +39,26 @@ export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
   }
 }
 
+export const USER_HANDLE_VALIDATOR: BuildFormValidator = {
+  VALIDATORS: [
+    Validators.required,
+    Validators.pattern(/@.+/)
+  ],
+  MESSAGES: {
+    'required': $localize`Handle is required.`,
+    'pattern': $localize`Handle must be valid (eg. chocobozzz@example.com).`
+  }
+}
+
+export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = {
+  VALIDATORS: [
+    Validators.required
+  ],
+  MESSAGES: {
+    'required': $localize`Password is required.`
+  }
+}
+
 export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
   VALIDATORS: [
     Validators.required,
@@ -106,9 +126,7 @@ export const USER_DESCRIPTION_VALIDATOR: BuildFormValidator = {
 }
 
 export const USER_TERMS_VALIDATOR: BuildFormValidator = {
-  VALIDATORS: [
-    Validators.requiredTrue
-  ],
+  VALIDATORS: [ Validators.requiredTrue ],
   MESSAGES: {
     'required': $localize`You must agree with the instance terms in order to register on it.`
   }