Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`))
],
MESSAGES: {
- 'required': $localize`Username is required.`,
- 'minlength': $localize`Username must be at least 1 character long.`,
- 'maxlength': $localize`Username cannot be more than 50 characters long.`,
- 'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
+ required: $localize`Username is required.`,
+ minlength: $localize`Username must be at least 1 character long.`,
+ maxlength: $localize`Username cannot be more than 50 characters long.`,
+ pattern: $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
}
}
Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
],
MESSAGES: {
- 'required': $localize`Channel name is required.`,
- 'minlength': $localize`Channel name must be at least 1 character long.`,
- 'maxlength': $localize`Channel name cannot be more than 50 characters long.`,
- 'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.`
+ required: $localize`Channel name is required.`,
+ minlength: $localize`Channel name must be at least 1 character long.`,
+ maxlength: $localize`Channel name cannot be more than 50 characters long.`,
+ pattern: $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.`
}
}
export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
- 'required': $localize`Email is required.`,
- 'email': $localize`Email must be valid.`
+ required: $localize`Email is required.`,
+ email: $localize`Email must be valid.`
}
}
Validators.pattern(/@.+/)
],
MESSAGES: {
- 'required': $localize`Handle is required.`,
- 'pattern': $localize`Handle must be valid (eg. chocobozzz@example.com).`
+ required: $localize`Handle is required.`,
+ pattern: $localize`Handle must be valid (eg. chocobozzz@example.com).`
}
}
Validators.required
],
MESSAGES: {
- 'required': $localize`Password is required.`
+ required: $localize`Password is required.`
}
}
-export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
+export const USER_OTP_TOKEN_VALIDATOR: BuildFormValidator = {
+ VALIDATORS: [
+ Validators.required
+ ],
+ MESSAGES: {
+ required: $localize`OTP token is required.`
+ }
+}
+
+export const USER_PASSWORD_VALIDATOR = {
VALIDATORS: [
Validators.required,
Validators.minLength(6),
Validators.maxLength(255)
],
MESSAGES: {
- 'required': $localize`Password is required.`,
- 'minlength': $localize`Password must be at least 6 characters long.`,
- 'maxlength': $localize`Password cannot be more than 255 characters long.`
+ required: $localize`Password is required.`,
+ minlength: $localize`Password must be at least 6 characters long.`,
+ maxlength: $localize`Password cannot be more than 255 characters long.`
}
}
Validators.maxLength(255)
],
MESSAGES: {
- 'minlength': $localize`Password must be at least 6 characters long.`,
- 'maxlength': $localize`Password cannot be more than 255 characters long.`
+ minlength: $localize`Password must be at least 6 characters long.`,
+ maxlength: $localize`Password cannot be more than 255 characters long.`
}
}
export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = {
VALIDATORS: [],
MESSAGES: {
- 'matchPassword': $localize`The new password and the confirmed password do not correspond.`
+ matchPassword: $localize`The new password and the confirmed password do not correspond.`
}
}
export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: {
- 'required': $localize`Video quota is required.`,
- 'min': $localize`Quota must be greater than -1.`
+ required: $localize`Video quota is required.`,
+ min: $localize`Quota must be greater than -1.`
}
}
export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: {
- 'required': $localize`Daily upload limit is required.`,
- 'min': $localize`Daily upload limit must be greater than -1.`
+ required: $localize`Daily upload limit is required.`,
+ min: $localize`Daily upload limit must be greater than -1.`
}
}
export const USER_ROLE_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': $localize`User role is required.`
+ required: $localize`User role is required.`
}
}
Validators.maxLength(1000)
],
MESSAGES: {
- 'minlength': $localize`Description must be at least 3 characters long.`,
- 'maxlength': $localize`Description cannot be more than 1000 characters long.`
- }
-}
-
-export const USER_TERMS_VALIDATOR: BuildFormValidator = {
- VALIDATORS: [ Validators.requiredTrue ],
- MESSAGES: {
- 'required': $localize`You must agree with the instance terms in order to register on it.`
+ minlength: $localize`Description must be at least 3 characters long.`,
+ maxlength: $localize`Description cannot be more than 1000 characters long.`
}
}
Validators.maxLength(250)
],
MESSAGES: {
- 'minlength': $localize`Ban reason must be at least 3 characters long.`,
- 'maxlength': $localize`Ban reason cannot be more than 250 characters long.`
+ minlength: $localize`Ban reason must be at least 3 characters long.`,
+ maxlength: $localize`Ban reason cannot be more than 250 characters long.`
}
}
Validators.maxLength(120)
],
MESSAGES: {
- 'required': $localize`Display name is required.`,
- 'minlength': $localize`Display name must be at least 1 character long.`,
- 'maxlength': $localize`Display name cannot be more than 50 characters long.`
+ required: $localize`Display name is required.`,
+ minlength: $localize`Display name must be at least 1 character long.`,
+ maxlength: $localize`Display name cannot be more than 50 characters long.`
}
}