chore: remove validators on the frontend (#1156)

* chore: update minlength of username

* remove the validator on frontend

* update
This commit is contained in:
Zeng1998
2023-02-25 14:59:29 +08:00
committed by GitHub
parent e64245099c
commit 57479b250a
7 changed files with 16 additions and 130 deletions

View File

@@ -67,6 +67,12 @@ func (create UserCreate) Validate() error {
if len(create.Username) > 32 {
return fmt.Errorf("username is too long, maximum length is 32")
}
if len(create.Password) < 3 {
return fmt.Errorf("password is too short, minimum length is 6")
}
if len(create.Password) > 512 {
return fmt.Errorf("password is too long, maximum length is 512")
}
if len(create.Nickname) > 64 {
return fmt.Errorf("nickname is too long, maximum length is 64")
}
@@ -107,6 +113,12 @@ func (patch UserPatch) Validate() error {
if patch.Username != nil && len(*patch.Username) > 32 {
return fmt.Errorf("username is too long, maximum length is 32")
}
if len(*patch.Password) < 3 {
return fmt.Errorf("password is too short, minimum length is 6")
}
if len(*patch.Password) > 512 {
return fmt.Errorf("password is too long, maximum length is 512")
}
if patch.Nickname != nil && len(*patch.Nickname) > 64 {
return fmt.Errorf("nickname is too long, maximum length is 64")
}