aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/forms/form-validators/login-validators.service.ts
blob: 9d68f830c3d53efc67e15d96f7d59c7ab2025d33 (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
27
28
29
30
import { I18n } from '@ngx-translate/i18n-polyfill'
import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
import { BuildFormValidator } from '@app/shared'

@Injectable()
export class LoginValidatorsService {
  readonly LOGIN_USERNAME: BuildFormValidator
  readonly LOGIN_PASSWORD: BuildFormValidator

  constructor (private i18n: I18n) {
    this.LOGIN_USERNAME = {
      VALIDATORS: [
        Validators.required
      ],
      MESSAGES: {
        'required': this.i18n('Username is required.')
      }
    }

    this.LOGIN_PASSWORD = {
      VALIDATORS: [
        Validators.required
      ],
      MESSAGES: {
        'required': this.i18n('Password is required.')
      }
    }
  }
}