aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/forms/form-validators/user.ts
blob: 0ad0e2a4b48900c6f050de41d906c857cd57c55b (plain) (blame)
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
import { Validators } from '@angular/forms';

import { validateEmail } from './email.validator';

export const USER_USERNAME = {
  VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ],
  MESSAGES: {
    'required': 'Username is required.',
    'minlength': 'Username must be at least 3 characters long.',
    'maxlength': 'Username cannot be more than 20 characters long.'
  }
};
export const USER_EMAIL = {
  VALIDATORS: [ Validators.required, validateEmail ],
  MESSAGES: {
    'required': 'Email is required.',
    'email': 'Email must be valid.',
  }
};
export const USER_PASSWORD = {
  VALIDATORS: [ Validators.required, Validators.minLength(6) ],
  MESSAGES: {
    'required': 'Password is required.',
    'minlength': 'Password must be at least 6 characters long.',
  }
};