Unverified Commit 37366dc2 authored by Zeng1998's avatar Zeng1998 Committed by GitHub

fix: patch user with nil password (#1290)

parent c1903df3
...@@ -113,10 +113,10 @@ func (patch UserPatch) Validate() error { ...@@ -113,10 +113,10 @@ func (patch UserPatch) Validate() error {
if patch.Username != nil && len(*patch.Username) > 32 { if patch.Username != nil && len(*patch.Username) > 32 {
return fmt.Errorf("username is too long, maximum length is 32") return fmt.Errorf("username is too long, maximum length is 32")
} }
if len(*patch.Password) < 3 { if patch.Password != nil && len(*patch.Password) < 3 {
return fmt.Errorf("password is too short, minimum length is 6") return fmt.Errorf("password is too short, minimum length is 6")
} }
if len(*patch.Password) > 512 { if patch.Password != nil && len(*patch.Password) > 512 {
return fmt.Errorf("password is too long, maximum length is 512") return fmt.Errorf("password is too long, maximum length is 512")
} }
if patch.Nickname != nil && len(*patch.Nickname) > 64 { if patch.Nickname != nil && len(*patch.Nickname) > 64 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment