From 1f256e7d3cf056c2d999260155cdba58ae1b878b Mon Sep 17 00:00:00 2001 From: Poslovitch Date: Sat, 24 Apr 2021 09:57:01 +0000 Subject: Implemented configurable minimum signup age Implements https://github.com/Chocobozzz/PeerTube/issues/3612 Fixed lint and removed debug Fixed another lint error Apply suggestions from code review Co-authored-by: Chocobozzz Add tests for min signup age config --- .../src/app/shared/form-validators/custom-config-validators.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts index ef6e9b456..1ed5700ff 100644 --- a/client/src/app/shared/form-validators/custom-config-validators.ts +++ b/client/src/app/shared/form-validators/custom-config-validators.ts @@ -49,6 +49,15 @@ export const SIGNUP_LIMIT_VALIDATOR: BuildFormValidator = { } } +export const SIGNUP_MINIMUM_AGE_VALIDATOR: BuildFormValidator = { + VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], + MESSAGES: { + 'required': $localize`Signup minimum age is required.`, + 'min': $localize`Signup minimum age must be greater than 1.`, + 'pattern': $localize`Signup minimum age must be a number.` + } +} + export const ADMIN_EMAIL_VALIDATOR: BuildFormValidator = { VALIDATORS: [Validators.required, Validators.email], MESSAGES: { -- cgit v1.2.3