From f6c15f895f98fa2156e86841c8f7d15eb53dff0f Mon Sep 17 00:00:00 2001 From: eelke Date: Fri, 8 Jul 2022 19:55:19 +0200 Subject: [PATCH] Catch exception from the password manager and pretend for now that the password was never saved. --- pglab/ConnectionController.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pglab/ConnectionController.cpp b/pglab/ConnectionController.cpp index 7824d3d..d0cf026 100644 --- a/pglab/ConnectionController.cpp +++ b/pglab/ConnectionController.cpp @@ -186,11 +186,18 @@ bool ConnectionController::retrieveConnectionPassword(ConnectionConfig &cc) bool ConnectionController::retrieveFromPasswordManager(const std::string &password_id, const std::string_view &enc_password, std::string &password) { - if (!UnlockPasswordManagerIfNeeded()) - return false; + try + { + if (!UnlockPasswordManagerIfNeeded()) + return false; - password = m_passwordManager->decrypt(password_id, enc_password); - return true; + password = m_passwordManager->decrypt(password_id, enc_password); + return true; + } + catch (const PasswordManagerException &ex) + { + return false; + } } bool ConnectionController::encryptPassword(ConnectionConfig &cc)