aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+signup/+register/shared/register-validators.ts
blob: f14803b68703dae5735110d3780ffed9ce2a3b2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Validators } from '@angular/forms'
import { BuildFormValidator } from '@app/shared/form-validators'

export const REGISTER_TERMS_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [ Validators.requiredTrue ],
  MESSAGES: {
    required: $localize`You must agree with the instance terms in order to register on it.`
  }
}

export const REGISTER_REASON_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
  MESSAGES: {
    required: $localize`Registration reason is required.`,
    minlength: $localize`Registration reason must be at least 2 characters long.`,
    maxlength: $localize`Registration reason cannot be more than 3000 characters long.`
  }
}