From e62be9db4f8421f1034923574724cfa6d456a304 Mon Sep 17 00:00:00 2001 From: Renz Date: Fri, 7 Nov 2025 14:56:29 +0000 Subject: [PATCH] Fix: Add authentication check to interactive mode - Show authentication mismatch warning before entering TUI - Prevents confusing error messages inside TUI - Users see helpful guidance immediately - Consistent with CLI mode behavior --- cmd/placeholder.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/placeholder.go b/cmd/placeholder.go index dd6b4e6..00223ab 100644 --- a/cmd/placeholder.go +++ b/cmd/placeholder.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "dbbackup/internal/auth" "dbbackup/internal/logger" "dbbackup/internal/tui" "github.com/spf13/cobra" @@ -46,6 +47,14 @@ var interactiveCmd = &cobra.Command{ Long: `Start the interactive menu system for guided backup operations.`, Aliases: []string{"menu", "ui"}, RunE: func(cmd *cobra.Command, args []string) error { + // Check authentication before starting TUI + if cfg.IsPostgreSQL() { + if mismatch, msg := auth.CheckAuthenticationMismatch(cfg); mismatch { + fmt.Println(msg) + return fmt.Errorf("authentication configuration required") + } + } + // Start the interactive TUI with silent logger to prevent console output conflicts silentLog := logger.NewSilent() return tui.RunInteractiveMenu(cfg, silentLog)