diff options
Diffstat (limited to 'client/src/app/shared/forms/form-validators')
-rw-r--r-- | client/src/app/shared/forms/form-validators/form-validator.service.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/forms/form-validators/user-validators.service.ts | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/client/src/app/shared/forms/form-validators/form-validator.service.ts b/client/src/app/shared/forms/form-validators/form-validator.service.ts index d10e17ca7..19a8bef25 100644 --- a/client/src/app/shared/forms/form-validators/form-validator.service.ts +++ b/client/src/app/shared/forms/form-validators/form-validator.service.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' | 1 | import { FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
3 | import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared/forms/form-reactive' | 3 | import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared/forms/form-reactive' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | 4 | ||
6 | export type BuildFormValidator = { | 5 | export type BuildFormValidator = { |
7 | VALIDATORS: ValidatorFn[], | 6 | VALIDATORS: ValidatorFn[], |
@@ -18,8 +17,7 @@ export type BuildFormDefaultValues = { | |||
18 | export class FormValidatorService { | 17 | export class FormValidatorService { |
19 | 18 | ||
20 | constructor ( | 19 | constructor ( |
21 | private formBuilder: FormBuilder, | 20 | private formBuilder: FormBuilder |
22 | private i18n: I18n | ||
23 | ) {} | 21 | ) {} |
24 | 22 | ||
25 | buildForm (obj: BuildFormArgument, defaultValues: BuildFormDefaultValues = {}) { | 23 | buildForm (obj: BuildFormArgument, defaultValues: BuildFormDefaultValues = {}) { |
diff --git a/client/src/app/shared/forms/form-validators/user-validators.service.ts b/client/src/app/shared/forms/form-validators/user-validators.service.ts index bb6ff2068..5edae2e38 100644 --- a/client/src/app/shared/forms/form-validators/user-validators.service.ts +++ b/client/src/app/shared/forms/form-validators/user-validators.service.ts | |||
@@ -12,6 +12,7 @@ export class UserValidatorsService { | |||
12 | readonly USER_ROLE: BuildFormValidator | 12 | readonly USER_ROLE: BuildFormValidator |
13 | readonly USER_DISPLAY_NAME: BuildFormValidator | 13 | readonly USER_DISPLAY_NAME: BuildFormValidator |
14 | readonly USER_DESCRIPTION: BuildFormValidator | 14 | readonly USER_DESCRIPTION: BuildFormValidator |
15 | readonly USER_TERMS: BuildFormValidator | ||
15 | 16 | ||
16 | constructor (private i18n: I18n) { | 17 | constructor (private i18n: I18n) { |
17 | 18 | ||
@@ -89,5 +90,14 @@ export class UserValidatorsService { | |||
89 | 'maxlength': this.i18n('Description cannot be more than 250 characters long.') | 90 | 'maxlength': this.i18n('Description cannot be more than 250 characters long.') |
90 | } | 91 | } |
91 | } | 92 | } |
93 | |||
94 | this.USER_TERMS = { | ||
95 | VALIDATORS: [ | ||
96 | Validators.requiredTrue | ||
97 | ], | ||
98 | MESSAGES: { | ||
99 | 'required': this.i18n('You must to agree with the instance terms in order to registering on it.') | ||
100 | } | ||
101 | } | ||
92 | } | 102 | } |
93 | } | 103 | } |