-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cmd): add database user password update #1036
feat(cmd): add database user password update #1036
Conversation
d5e057e
to
e50d2ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions otherwise LGTM
db/users/update.go
Outdated
return nil | ||
} | ||
|
||
password, confirmedPassword, err := askForPassword(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: allow client to retry 3 times to set his own password
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep why not
|
||
isPasswordGenerated := false | ||
if password == "" { | ||
isPasswordGenerated = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: display a message that password will be generated because left empty or max retry attempts reached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already handled by askForPassword
or you're looking for something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message in askForPassword
just say that if the client let it empty it will be generated but if he tries 3 times and fail, we will generate it for him without any message to inform him.
Do you see what I mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what you means.
But I'm not sure we want to change the behavior as it is what the API expects actually, empty password and confirmation to make it generate one: https://developers.scalingo.com/databases/users
I've updated the description of this PR with an example of generated password. It is more clear and/or ok for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, sorry misread your code 🙁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem :)
cmd/databases.go
Outdated
&addonFlag, | ||
}, | ||
Description: CommandDescription{ | ||
Description: `Update a non-protected database user's password. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence may be misunderstood, like the "database is non-protected" when it's the user who is non-protected.
I suggest:
Description: `Update a non-protected database user's password. | |
Description: `Update password for unprotected database user. |
WDYT?
@@ -10,14 +10,14 @@ import ( | |||
"github.com/Scalingo/cli/config" | |||
"github.com/Scalingo/cli/io" | |||
"github.com/Scalingo/go-scalingo/v6" | |||
scErrors "github.com/Scalingo/go-utils/errors/v2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: thanks for handling this 🙏
7ca53ff
to
f18a31c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One remaining suggestion otherwise LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
||
isPasswordGenerated := false | ||
if password == "" { | ||
isPasswordGenerated = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, sorry misread your code 🙁
Examples
Max retry reached
User does not exists
It works after a retry
It works generates a password
Fixes #1034