From 1ab3a37056769fc578f90ae9f0a1e5b1e18638d7 Mon Sep 17 00:00:00 2001 From: Integral Date: Sun, 19 May 2024 13:25:18 -0700 Subject: [PATCH 1/3] Add dialog for repeating password when exporting keys --- src/UserSettingsPage.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 49fb6a59..0ba2386c 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -2127,11 +2127,25 @@ UserSettingsModel::exportSessionKeys() if (!ok) return; + auto repeatedPassword = QInputDialog::getText(nullptr, + tr("Repeat File Password"), + tr("Repeat the passphrase:"), + QLineEdit::Password, + QLatin1String(""), + &ok); + if (!ok) + return; + if (password.isEmpty()) { QMessageBox::warning(nullptr, tr("Error"), tr("The password cannot be empty")); return; } + if (password != repeatedPassword) { + QMessageBox::warning(nullptr, tr("Error"), tr("Passwords don't match")); + return; + } + // Open file dialog to save the file. const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); const QString fileName = QFileDialog::getSaveFileName( From 95dc80ddecc3f39757f398b53c6abd267852c69f Mon Sep 17 00:00:00 2001 From: Integral Date: Sun, 26 May 2024 02:22:14 +0000 Subject: [PATCH 2/3] Update src/UserSettingsPage.cpp Co-authored-by: Urszula --- src/UserSettingsPage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 0ba2386c..4dfdc96a 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -2141,6 +2141,11 @@ UserSettingsModel::exportSessionKeys() return; } + if (repeatedPassword.isEmpty()) { + QMessageBox::warning(nullptr, tr("Error"), tr("Please repeat the password")); + return; + } + if (password != repeatedPassword) { QMessageBox::warning(nullptr, tr("Error"), tr("Passwords don't match")); return; From 992468d6c172231847b9a28379181601b0e4f5e4 Mon Sep 17 00:00:00 2001 From: Integral Date: Mon, 17 Jun 2024 11:00:45 +0800 Subject: [PATCH 3/3] Place repeatedPassword after first check & remove unnecessary empty check --- src/UserSettingsPage.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 4dfdc96a..f50bc3c0 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -2127,6 +2127,11 @@ UserSettingsModel::exportSessionKeys() if (!ok) return; + if (password.isEmpty()) { + QMessageBox::warning(nullptr, tr("Error"), tr("The password cannot be empty")); + return; + } + auto repeatedPassword = QInputDialog::getText(nullptr, tr("Repeat File Password"), tr("Repeat the passphrase:"), @@ -2136,16 +2141,6 @@ UserSettingsModel::exportSessionKeys() if (!ok) return; - if (password.isEmpty()) { - QMessageBox::warning(nullptr, tr("Error"), tr("The password cannot be empty")); - return; - } - - if (repeatedPassword.isEmpty()) { - QMessageBox::warning(nullptr, tr("Error"), tr("Please repeat the password")); - return; - } - if (password != repeatedPassword) { QMessageBox::warning(nullptr, tr("Error"), tr("Passwords don't match")); return;