From b5c2f6e551091410254bc97f111d2abcb7e30fb7 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Wed, 1 Mar 2023 17:06:28 -0500 Subject: [PATCH] no login override popup when invalid private key --- cli/packages/cmd/login.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/packages/cmd/login.go b/cli/packages/cmd/login.go index f7876f542..c93af44f5 100644 --- a/cli/packages/cmd/login.go +++ b/cli/packages/cmd/login.go @@ -41,13 +41,14 @@ var loginCmd = &cobra.Command{ PreRun: toggleDebug, Run: func(cmd *cobra.Command, args []string) { currentLoggedInUserDetails, err := util.GetCurrentLoggedInUserDetails() - if err != nil && (strings.Contains(err.Error(), "The specified item could not be found in the keyring") || strings.Contains(err.Error(), "unable to get key from Keyring")) { // if the key can't be found allow them to override + // if the key can't be found or there is an error getting current credentials from key ring, allow them to override + if err != nil && (strings.Contains(err.Error(), "The specified item could not be found in the keyring") || strings.Contains(err.Error(), "unable to get key from Keyring") || strings.Contains(err.Error(), "GetUserCredsFromKeyRing")) { log.Debug(err) } else if err != nil { util.HandleError(err) } - if currentLoggedInUserDetails.IsUserLoggedIn && !currentLoggedInUserDetails.LoginExpired { // if you are logged in but not expired + if currentLoggedInUserDetails.IsUserLoggedIn && !currentLoggedInUserDetails.LoginExpired && len(currentLoggedInUserDetails.UserCredentials.PrivateKey) != 0 { shouldOverride, err := shouldOverrideLoginPrompt(currentLoggedInUserDetails.UserCredentials.Email) if err != nil { util.HandleError(err)