From ef5f8310136881353bcfd23e4b13aa25859ccd54 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 27 May 2022 11:49:32 +0200 Subject: [PATCH] PasswordDialog: UI improvements --- src/MainWindow.cpp | 6 +++--- src/dialog/PasswordDialog.cpp | 3 ++- src/dialog/PasswordDialog.h | 2 +- src/dialog/PasswordDialog.ui | 9 ++++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 7d7db04..edbfd17 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1627,15 +1627,15 @@ void MainWindow::updateRecentlyOpenedMenu() { } bool MainWindow::verifyPassword() { - bool ok; + bool incorrectPassword = false; while (true) { - PasswordDialog passwordDialog{this->walletName(), false, this}; + PasswordDialog passwordDialog{this->walletName(), incorrectPassword, true, this}; int ret = passwordDialog.exec(); if (ret == QDialog::Rejected) { return false; } if (passwordDialog.password != m_ctx->wallet->getPassword()) { - QMessageBox::warning(this, "Error", "Incorrect password"); + incorrectPassword = true; continue; } break; diff --git a/src/dialog/PasswordDialog.cpp b/src/dialog/PasswordDialog.cpp index 7465166..42417f1 100644 --- a/src/dialog/PasswordDialog.cpp +++ b/src/dialog/PasswordDialog.cpp @@ -6,7 +6,7 @@ #include "utils/Icons.h" -PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword, QWidget *parent) +PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword, bool sensitive, QWidget *parent) : WindowModalDialog(parent) , ui(new Ui::PasswordDialog) { @@ -15,6 +15,7 @@ PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword this->setWindowIcon(icons()->icon("appicons/64x64.png")); ui->label_wallet->setText(QString("Please enter password for wallet: %1").arg(walletName)); ui->label_incorrectPassword->setVisible(incorrectPassword); + ui->label_sensitive->setVisible(sensitive); connect(ui->buttonBox, &QDialogButtonBox::accepted, [this]{ password = ui->line_password->text(); diff --git a/src/dialog/PasswordDialog.h b/src/dialog/PasswordDialog.h index 78d82b9..73fc746 100644 --- a/src/dialog/PasswordDialog.h +++ b/src/dialog/PasswordDialog.h @@ -17,7 +17,7 @@ class PasswordDialog : public WindowModalDialog Q_OBJECT public: - explicit PasswordDialog(const QString &walletName, bool incorrectPassword, QWidget *parent = nullptr); + explicit PasswordDialog(const QString &walletName, bool incorrectPassword, bool sensitive = false, QWidget *parent = nullptr); ~PasswordDialog() override; QString password = ""; diff --git a/src/dialog/PasswordDialog.ui b/src/dialog/PasswordDialog.ui index 1ef82e5..41b949b 100644 --- a/src/dialog/PasswordDialog.ui +++ b/src/dialog/PasswordDialog.ui @@ -7,13 +7,20 @@ 0 0 832 - 158 + 168 Password required + + + + This dialog contains sensitive information. + + +