Skip to content

Commit 9f06b09

Browse files
author
jmccormick2001
committed
fix setting password using --password on pgo user command
1 parent 2ced929 commit 9f06b09

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

apiserver/userservice/userimpl.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ func User(request *msgs.UserRequest) msgs.UserResponse {
121121
log.Debug(msg)
122122
resp.Results = append(resp.Results, msg)
123123
newPassword := util.GeneratePassword(defaultPasswordLength)
124+
if request.Password != "" {
125+
parts := strings.Split(request.Password, " ")
126+
if len(parts) > 1 {
127+
resp.Status.Code = msgs.Error
128+
resp.Status.Msg = "invalid password format, can not contain spaces"
129+
return resp
130+
}
131+
newPassword = request.Password
132+
}
124133
newExpireDate := GeneratePasswordExpireDate(request.PasswordAgeDays)
125134
pgbouncer := cluster.Spec.UserLabels[util.LABEL_PGBOUNCER] == "true"
126135
pgpool := cluster.Spec.UserLabels[util.LABEL_PGPOOL] == "true"

0 commit comments

Comments
 (0)