aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorkimsible <kimsible@users.noreply.github.com>2020-07-27 00:01:15 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-11 08:46:35 +0200
commit4abe9c593aab52391e4cb9e3a578ed46a479934d (patch)
treeb42c819acc96612b1f0d926d8706660a9096a364 /client/src/app/shared
parent62fc691548594bc96fd43e0c29dcd4191cb525f5 (diff)
downloadPeerTube-4abe9c593aab52391e4cb9e3a578ed46a479934d.tar.gz
PeerTube-4abe9c593aab52391e4cb9e3a578ed46a479934d.tar.zst
PeerTube-4abe9c593aab52391e4cb9e3a578ed46a479934d.zip
Add validator channel name
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-forms/form-validators/user-validators.service.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts
index bd3030a54..61486bbab 100644
--- a/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts
+++ b/client/src/app/shared/shared-forms/form-validators/user-validators.service.ts
@@ -6,6 +6,7 @@ import { Injectable } from '@angular/core'
6@Injectable() 6@Injectable()
7export class UserValidatorsService { 7export class UserValidatorsService {
8 readonly USER_USERNAME: BuildFormValidator 8 readonly USER_USERNAME: BuildFormValidator
9 readonly USER_CHANNEL_NAME: BuildFormValidator
9 readonly USER_EMAIL: BuildFormValidator 10 readonly USER_EMAIL: BuildFormValidator
10 readonly USER_PASSWORD: BuildFormValidator 11 readonly USER_PASSWORD: BuildFormValidator
11 readonly USER_PASSWORD_OPTIONAL: BuildFormValidator 12 readonly USER_PASSWORD_OPTIONAL: BuildFormValidator
@@ -36,6 +37,21 @@ export class UserValidatorsService {
36 } 37 }
37 } 38 }
38 39
40 this.USER_CHANNEL_NAME = {
41 VALIDATORS: [
42 Validators.required,
43 Validators.minLength(1),
44 Validators.maxLength(50),
45 Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
46 ],
47 MESSAGES: {
48 'required': this.i18n('Channel name is required.'),
49 'minlength': this.i18n('Channel name must be at least 1 character long.'),
50 'maxlength': this.i18n('Channel name cannot be more than 50 characters long.'),
51 'pattern': this.i18n('Channel name should be lowercase alphanumeric; dots and underscores are allowed.')
52 }
53 }
54
39 this.USER_EMAIL = { 55 this.USER_EMAIL = {
40 VALIDATORS: [ Validators.required, Validators.email ], 56 VALIDATORS: [ Validators.required, Validators.email ],
41 MESSAGES: { 57 MESSAGES: {