From 73bf912422c8dc9d3e203ea4144f7f24e6b5ca43 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 8 Feb 2026 11:28:13 +0100 Subject: [PATCH] cli/password: allow forced reset (#27293) --- cmd/password_reset.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd/password_reset.go b/cmd/password_reset.go index 9073509ed..b82503f68 100644 --- a/cmd/password_reset.go +++ b/cmd/password_reset.go @@ -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 {