Unverified Commit ac5d8b47 authored by zhangpeng's avatar zhangpeng Committed by GitHub

chore: modify the error message when registering a Host user (#1804)

* Modify the error message

* modify the error message
parent 77e8e9eb
...@@ -68,7 +68,7 @@ func (create UserCreate) Validate() error { ...@@ -68,7 +68,7 @@ func (create UserCreate) Validate() error {
return fmt.Errorf("username is too long, maximum length is 32") return fmt.Errorf("username is too long, maximum length is 32")
} }
if len(create.Password) < 3 { if len(create.Password) < 3 {
return fmt.Errorf("password is too short, minimum length is 6") return fmt.Errorf("password is too short, minimum length is 3")
} }
if len(create.Password) > 512 { if len(create.Password) > 512 {
return fmt.Errorf("password is too long, maximum length is 512") return fmt.Errorf("password is too long, maximum length is 512")
...@@ -114,7 +114,7 @@ func (patch UserPatch) Validate() error { ...@@ -114,7 +114,7 @@ func (patch UserPatch) Validate() error {
return fmt.Errorf("username is too long, maximum length is 32") return fmt.Errorf("username is too long, maximum length is 32")
} }
if patch.Password != nil && 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 3")
} }
if patch.Password != nil && 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")
......
...@@ -101,7 +101,7 @@ func TestSetupServiceCreateUser(t *testing.T) { ...@@ -101,7 +101,7 @@ func TestSetupServiceCreateUser(t *testing.T) {
}, },
`username != "", password == ""`: { `username != "", password == ""`: {
hostUsername: expectedCreated.Username, hostUsername: expectedCreated.Username,
expectedErr: "validate: password is too short, minimum length is 6", expectedErr: "validate: password is too short, minimum length is 3",
}, },
"failed to create": { "failed to create": {
setupStore: func(m *storeMock) { setupStore: func(m *storeMock) {
......
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