]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/forms/form-validators/user.ts
Fix video channel description/support max length
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-validators / user.ts
CommitLineData
df98563e 1import { Validators } from '@angular/forms'
4b2f33f3
C
2
3export const USER_USERNAME = {
563d032e
C
4 VALIDATORS: [
5 Validators.required,
6 Validators.minLength(3),
7 Validators.maxLength(20),
8 Validators.pattern(/^[a-z0-9._]+$/)
9 ],
4b2f33f3
C
10 MESSAGES: {
11 'required': 'Username is required.',
12 'minlength': 'Username must be at least 3 characters long.',
563d032e
C
13 'maxlength': 'Username cannot be more than 20 characters long.',
14 'pattern': 'Username should be only lowercase alphanumeric characters.'
4b2f33f3 15 }
df98563e 16}
ad4a8a1c 17export const USER_EMAIL = {
c689fcdc 18 VALIDATORS: [ Validators.required, Validators.email ],
ad4a8a1c
C
19 MESSAGES: {
20 'required': 'Email is required.',
df98563e 21 'email': 'Email must be valid.'
ad4a8a1c 22 }
df98563e 23}
4b2f33f3 24export const USER_PASSWORD = {
dce1d795 25 VALIDATORS: [
26 Validators.required,
27 Validators.minLength(6),
28 Validators.maxLength(255)
29 ],
4b2f33f3
C
30 MESSAGES: {
31 'required': 'Password is required.',
dce1d795 32 'minlength': 'Password must be at least 6 characters long.',
33 'maxlength': 'Password cannot be more than 255 characters long.'
4b2f33f3 34 }
df98563e 35}
b0f9f39e
C
36export const USER_VIDEO_QUOTA = {
37 VALIDATORS: [ Validators.required, Validators.min(-1) ],
38 MESSAGES: {
39 'required': 'Video quota is required.',
40 'min': 'Quota must be greater than -1.'
41 }
980246ea 42}
954605a8
C
43export const USER_ROLE = {
44 VALIDATORS: [ Validators.required ],
45 MESSAGES: {
757f0da3 46 'required': 'User role is required.'
954605a8
C
47 }
48}
ed56ad11
C
49export const USER_DISPLAY_NAME = {
50 VALIDATORS: [
51 Validators.required,
52 Validators.minLength(3),
53 Validators.maxLength(120)
54 ],
55 MESSAGES: {
56 'required': 'Display name is required.',
57 'minlength': 'Display name must be at least 3 characters long.',
58 'maxlength': 'Display name cannot be more than 120 characters long.'
59 }
60}
61export const USER_DESCRIPTION = {
62 VALIDATORS: [
ed56ad11
C
63 Validators.minLength(3),
64 Validators.maxLength(250)
65 ],
66 MESSAGES: {
acf24c74
GN
67 'minlength': 'Description must be at least 3 characters long.',
68 'maxlength': 'Description cannot be more than 250 characters long.'
ed56ad11
C
69 }
70}