1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import { Validators } from '@angular/forms'
export const USER_USERNAME = {
VALIDATORS: [
Validators.required,
Validators.minLength(3),
Validators.maxLength(20),
Validators.pattern(/^[a-z0-9._]+$/)
],
MESSAGES: {
'required': 'Username is required.',
'minlength': 'Username must be at least 3 characters long.',
'maxlength': 'Username cannot be more than 20 characters long.',
'pattern': 'Username should be only lowercase alphanumeric characters.'
}
}
export const USER_EMAIL = {
VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
'required': 'Email is required.',
'email': 'Email must be valid.'
}
}
export const USER_PASSWORD = {
VALIDATORS: [
Validators.required,
Validators.minLength(6),
Validators.maxLength(255)
],
MESSAGES: {
'required': 'Password is required.',
'minlength': 'Password must be at least 6 characters long.',
'maxlength': 'Password cannot be more than 255 characters long.'
}
}
export const USER_VIDEO_QUOTA = {
VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: {
'required': 'Video quota is required.',
'min': 'Quota must be greater than -1.'
}
}
export const USER_ROLE = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
'required': 'User role is required.'
}
}
|