diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:42:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 08:35:06 +0200 |
commit | 9df52d660feb722404be00a50f3c8a612bec1c15 (patch) | |
tree | dde52880fa012874d24c60f64eb596b0a789cc8b /client/src/app/shared/form-validators/user-validators.ts | |
parent | adb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff) | |
download | PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip |
Migrate client to eslint
Diffstat (limited to 'client/src/app/shared/form-validators/user-validators.ts')
-rw-r--r-- | client/src/app/shared/form-validators/user-validators.ts | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/client/src/app/shared/form-validators/user-validators.ts b/client/src/app/shared/form-validators/user-validators.ts index 976c97b87..6d0dea64e 100644 --- a/client/src/app/shared/form-validators/user-validators.ts +++ b/client/src/app/shared/form-validators/user-validators.ts | |||
@@ -11,10 +11,10 @@ export const USER_USERNAME_VALIDATOR: BuildFormValidator = { | |||
11 | Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`)) | 11 | Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`)) |
12 | ], | 12 | ], |
13 | MESSAGES: { | 13 | MESSAGES: { |
14 | 'required': $localize`Username is required.`, | 14 | required: $localize`Username is required.`, |
15 | 'minlength': $localize`Username must be at least 1 character long.`, | 15 | minlength: $localize`Username must be at least 1 character long.`, |
16 | 'maxlength': $localize`Username cannot be more than 50 characters long.`, | 16 | maxlength: $localize`Username cannot be more than 50 characters long.`, |
17 | 'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.` | 17 | pattern: $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.` |
18 | } | 18 | } |
19 | } | 19 | } |
20 | 20 | ||
@@ -26,18 +26,18 @@ export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = { | |||
26 | Validators.pattern(/^[a-z0-9][a-z0-9._]*$/) | 26 | Validators.pattern(/^[a-z0-9][a-z0-9._]*$/) |
27 | ], | 27 | ], |
28 | MESSAGES: { | 28 | MESSAGES: { |
29 | 'required': $localize`Channel name is required.`, | 29 | required: $localize`Channel name is required.`, |
30 | 'minlength': $localize`Channel name must be at least 1 character long.`, | 30 | minlength: $localize`Channel name must be at least 1 character long.`, |
31 | 'maxlength': $localize`Channel name cannot be more than 50 characters long.`, | 31 | maxlength: $localize`Channel name cannot be more than 50 characters long.`, |
32 | 'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.` | 32 | pattern: $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.` |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | export const USER_EMAIL_VALIDATOR: BuildFormValidator = { | 36 | export const USER_EMAIL_VALIDATOR: BuildFormValidator = { |
37 | VALIDATORS: [ Validators.required, Validators.email ], | 37 | VALIDATORS: [ Validators.required, Validators.email ], |
38 | MESSAGES: { | 38 | MESSAGES: { |
39 | 'required': $localize`Email is required.`, | 39 | required: $localize`Email is required.`, |
40 | 'email': $localize`Email must be valid.` | 40 | email: $localize`Email must be valid.` |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
@@ -47,8 +47,8 @@ export const USER_HANDLE_VALIDATOR: BuildFormValidator = { | |||
47 | Validators.pattern(/@.+/) | 47 | Validators.pattern(/@.+/) |
48 | ], | 48 | ], |
49 | MESSAGES: { | 49 | MESSAGES: { |
50 | 'required': $localize`Handle is required.`, | 50 | required: $localize`Handle is required.`, |
51 | 'pattern': $localize`Handle must be valid (eg. chocobozzz@example.com).` | 51 | pattern: $localize`Handle must be valid (eg. chocobozzz@example.com).` |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
@@ -57,7 +57,7 @@ export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = { | |||
57 | Validators.required | 57 | Validators.required |
58 | ], | 58 | ], |
59 | MESSAGES: { | 59 | MESSAGES: { |
60 | 'required': $localize`Password is required.` | 60 | required: $localize`Password is required.` |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -68,9 +68,9 @@ export const USER_PASSWORD_VALIDATOR: BuildFormValidator = { | |||
68 | Validators.maxLength(255) | 68 | Validators.maxLength(255) |
69 | ], | 69 | ], |
70 | MESSAGES: { | 70 | MESSAGES: { |
71 | 'required': $localize`Password is required.`, | 71 | required: $localize`Password is required.`, |
72 | 'minlength': $localize`Password must be at least 6 characters long.`, | 72 | minlength: $localize`Password must be at least 6 characters long.`, |
73 | 'maxlength': $localize`Password cannot be more than 255 characters long.` | 73 | maxlength: $localize`Password cannot be more than 255 characters long.` |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
@@ -80,37 +80,37 @@ export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = { | |||
80 | Validators.maxLength(255) | 80 | Validators.maxLength(255) |
81 | ], | 81 | ], |
82 | MESSAGES: { | 82 | MESSAGES: { |
83 | 'minlength': $localize`Password must be at least 6 characters long.`, | 83 | minlength: $localize`Password must be at least 6 characters long.`, |
84 | 'maxlength': $localize`Password cannot be more than 255 characters long.` | 84 | maxlength: $localize`Password cannot be more than 255 characters long.` |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = { | 88 | export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = { |
89 | VALIDATORS: [], | 89 | VALIDATORS: [], |
90 | MESSAGES: { | 90 | MESSAGES: { |
91 | 'matchPassword': $localize`The new password and the confirmed password do not correspond.` | 91 | matchPassword: $localize`The new password and the confirmed password do not correspond.` |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = { | 95 | export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = { |
96 | VALIDATORS: [ Validators.required, Validators.min(-1) ], | 96 | VALIDATORS: [ Validators.required, Validators.min(-1) ], |
97 | MESSAGES: { | 97 | MESSAGES: { |
98 | 'required': $localize`Video quota is required.`, | 98 | required: $localize`Video quota is required.`, |
99 | 'min': $localize`Quota must be greater than -1.` | 99 | min: $localize`Quota must be greater than -1.` |
100 | } | 100 | } |
101 | } | 101 | } |
102 | export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = { | 102 | export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = { |
103 | VALIDATORS: [ Validators.required, Validators.min(-1) ], | 103 | VALIDATORS: [ Validators.required, Validators.min(-1) ], |
104 | MESSAGES: { | 104 | MESSAGES: { |
105 | 'required': $localize`Daily upload limit is required.`, | 105 | required: $localize`Daily upload limit is required.`, |
106 | 'min': $localize`Daily upload limit must be greater than -1.` | 106 | min: $localize`Daily upload limit must be greater than -1.` |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | export const USER_ROLE_VALIDATOR: BuildFormValidator = { | 110 | export const USER_ROLE_VALIDATOR: BuildFormValidator = { |
111 | VALIDATORS: [ Validators.required ], | 111 | VALIDATORS: [ Validators.required ], |
112 | MESSAGES: { | 112 | MESSAGES: { |
113 | 'required': $localize`User role is required.` | 113 | required: $localize`User role is required.` |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
@@ -122,15 +122,15 @@ export const USER_DESCRIPTION_VALIDATOR: BuildFormValidator = { | |||
122 | Validators.maxLength(1000) | 122 | Validators.maxLength(1000) |
123 | ], | 123 | ], |
124 | MESSAGES: { | 124 | MESSAGES: { |
125 | 'minlength': $localize`Description must be at least 3 characters long.`, | 125 | minlength: $localize`Description must be at least 3 characters long.`, |
126 | 'maxlength': $localize`Description cannot be more than 1000 characters long.` | 126 | maxlength: $localize`Description cannot be more than 1000 characters long.` |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | export const USER_TERMS_VALIDATOR: BuildFormValidator = { | 130 | export const USER_TERMS_VALIDATOR: BuildFormValidator = { |
131 | VALIDATORS: [ Validators.requiredTrue ], | 131 | VALIDATORS: [ Validators.requiredTrue ], |
132 | MESSAGES: { | 132 | MESSAGES: { |
133 | 'required': $localize`You must agree with the instance terms in order to register on it.` | 133 | required: $localize`You must agree with the instance terms in order to register on it.` |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
@@ -140,8 +140,8 @@ export const USER_BAN_REASON_VALIDATOR: BuildFormValidator = { | |||
140 | Validators.maxLength(250) | 140 | Validators.maxLength(250) |
141 | ], | 141 | ], |
142 | MESSAGES: { | 142 | MESSAGES: { |
143 | 'minlength': $localize`Ban reason must be at least 3 characters long.`, | 143 | minlength: $localize`Ban reason must be at least 3 characters long.`, |
144 | 'maxlength': $localize`Ban reason cannot be more than 250 characters long.` | 144 | maxlength: $localize`Ban reason cannot be more than 250 characters long.` |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
@@ -152,9 +152,9 @@ function buildDisplayNameValidator (required: boolean) { | |||
152 | Validators.maxLength(120) | 152 | Validators.maxLength(120) |
153 | ], | 153 | ], |
154 | MESSAGES: { | 154 | MESSAGES: { |
155 | 'required': $localize`Display name is required.`, | 155 | required: $localize`Display name is required.`, |
156 | 'minlength': $localize`Display name must be at least 1 character long.`, | 156 | minlength: $localize`Display name must be at least 1 character long.`, |
157 | 'maxlength': $localize`Display name cannot be more than 50 characters long.` | 157 | maxlength: $localize`Display name cannot be more than 50 characters long.` |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||