cli/password: allow forced reset (#27293)
This commit is contained in:
parent
9a9527d224
commit
73bf912422
1 changed files with 11 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ var passwordResetCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
passwordCmd.AddCommand(passwordResetCmd)
|
||||
passwordResetCmd.Flags().BoolP(flagForce, "f", false, "Force (no confirmation)")
|
||||
}
|
||||
|
||||
func runPasswordReset(cmd *cobra.Command, args []string) {
|
||||
|
|
@ -28,14 +29,17 @@ func runPasswordReset(cmd *cobra.Command, args []string) {
|
|||
log.FATAL.Fatal(err)
|
||||
}
|
||||
|
||||
prompt := &survey.Confirm{
|
||||
Message: "Are you sure?",
|
||||
Help: "help",
|
||||
}
|
||||
confirm, _ := cmd.Flags().GetBool(flagForce)
|
||||
|
||||
var confirm bool
|
||||
if err := survey.AskOne(prompt, &confirm); err != nil {
|
||||
log.FATAL.Fatal(err)
|
||||
if !confirm {
|
||||
prompt := &survey.Confirm{
|
||||
Message: "Are you sure?",
|
||||
Help: "help",
|
||||
}
|
||||
|
||||
if err := survey.AskOne(prompt, &confirm); err != nil {
|
||||
log.FATAL.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if confirm {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue