Skip to content

Commit

Permalink
make username, display_name and video_channel_name min length 1 and m…
Browse files Browse the repository at this point in the history
…ax length 50; still some bug on the frontend complains but if you remove the disabled property it creates the account just fine (fixes Chocobozzz#1263)
  • Loading branch information
McFlat committed Oct 14, 2018
1 parent 0e5ff97 commit 29faa6c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export class UserValidatorsService {
this.USER_USERNAME = {
VALIDATORS: [
Validators.required,
Validators.minLength(3),
Validators.maxLength(20),
Validators.pattern(/^[a-z0-9._]+$/)
Validators.minLength(1),
Validators.maxLength(50),
Validators.pattern(/^[a-zA-Z]+[a-zA-Z0-9-._]+$/)
],
MESSAGES: {
'required': this.i18n('Username is required.'),
'minlength': this.i18n('Username must be at least 3 characters long.'),
'maxlength': this.i18n('Username cannot be more than 20 characters long.'),
'pattern': this.i18n('Username should be only lowercase alphanumeric characters.')
'minlength': this.i18n('Username must be at least 1 character long.'),
'maxlength': this.i18n('Username cannot be more than 50 characters long.'),
'pattern': this.i18n('Username should start with a letter; numbers, dots, dashes and underscores are allowed.')
}
}

Expand Down Expand Up @@ -88,13 +88,13 @@ export class UserValidatorsService {
this.USER_DISPLAY_NAME = {
VALIDATORS: [
Validators.required,
Validators.minLength(3),
Validators.maxLength(120)
Validators.minLength(1),
Validators.maxLength(50)
],
MESSAGES: {
'required': this.i18n('Display name is required.'),
'minlength': this.i18n('Display name must be at least 3 characters long.'),
'maxlength': this.i18n('Display name cannot be more than 120 characters long.')
'minlength': this.i18n('Display name must be at least 1 characters long.'),
'maxlength': this.i18n('Display name cannot be more than 50 characters long.')
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ export class VideoChannelValidatorsService {
this.VIDEO_CHANNEL_NAME = {
VALIDATORS: [
Validators.required,
Validators.minLength(3),
Validators.maxLength(20),
Validators.pattern(/^[a-z0-9._]+$/)
Validators.minLength(1),
Validators.maxLength(50),
Validators.pattern(/^[a-zA-Z]+[a-zA-Z0-9-._]+$/)
],
MESSAGES: {
'required': this.i18n('Name is required.'),
'minlength': this.i18n('Name must be at least 3 characters long.'),
'maxlength': this.i18n('Name cannot be more than 20 characters long.'),
'pattern': this.i18n('Name should be only lowercase alphanumeric characters.')
'minlength': this.i18n('Name must be at least 1 characters long.'),
'maxlength': this.i18n('Name cannot be more than 50 characters long.'),
'pattern': this.i18n('Name should start with a letter; numbers, dots, dashes and underscores are allowed.')
}
}

this.VIDEO_CHANNEL_DISPLAY_NAME = {
VALIDATORS: [
Validators.required,
Validators.minLength(3),
Validators.maxLength(120)
Validators.minLength(1),
Validators.maxLength(50)
],
MESSAGES: {
'required': i18n('Display name is required.'),
'minlength': i18n('Display name must be at least 3 characters long.'),
'maxlength': i18n('Display name cannot be more than 120 characters long.')
'minlength': i18n('Display name must be at least 1 characters long.'),
'maxlength': i18n('Display name cannot be more than 50 characters long.')
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/initializers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ const CONFIG = {

const CONSTRAINTS_FIELDS = {
USERS: {
NAME: { min: 3, max: 120 }, // Length
NAME: { min: 1, max: 50 }, // Length
DESCRIPTION: { min: 3, max: 250 }, // Length
USERNAME: { min: 3, max: 20 }, // Length
USERNAME: { min: 1, max: 50 }, // Length
PASSWORD: { min: 6, max: 255 }, // Length
VIDEO_QUOTA: { min: -1 },
VIDEO_QUOTA_DAILY: { min: -1 },
Expand All @@ -307,7 +307,7 @@ const CONSTRAINTS_FIELDS = {
REASON: { min: 2, max: 300 } // Length
},
VIDEO_CHANNELS: {
NAME: { min: 3, max: 120 }, // Length
NAME: { min: 1, max: 50 }, // Length
DESCRIPTION: { min: 3, max: 500 }, // Length
SUPPORT: { min: 3, max: 500 }, // Length
URL: { min: 3, max: 2000 } // Length
Expand Down

0 comments on commit 29faa6c

Please sign in to comment.