]> 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 115930146a88a6db98aa3ba044b113d16959c5e1..fee37e95f1e35a53755af18ca307d2677f63623f 100644 (file)
@@ -39,6 +39,17 @@ 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
@@ -115,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.`
   }