Skip to content

Commit e389ae5

Browse files
authored
fix(rdb): prevent crash when updating user without password (#4690)
1 parent 87b1ae8 commit e389ae5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/namespaces/rdb/v1/custom_user.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package rdb
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"reflect"
78

@@ -183,6 +184,12 @@ func userUpdateBuilder(c *core.Command) *core.Command {
183184
fmt.Printf("\n")
184185
}
185186

187+
if !customRequest.GeneratePassword && customRequest.Password == nil {
188+
return nil, errors.New(
189+
"you must provide a password when generate-password is set to false",
190+
)
191+
}
192+
186193
user, err := api.UpdateUser(updateUserRequest)
187194
if err != nil {
188195
return nil, err

0 commit comments

Comments
 (0)