mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-23 15:00:47 -04:00
Correct issues with TOTP Setup
* Fix #3142 - Warn user when entering invalid TOTP secret key. * Fix #773 - The TOTP dialog now listens for the copy shortcut without having to press the Copy button. * Add ability to choose hash algorithm from the TOTP setup dialog * Add upgrade to "otp" attribute when custom attributes are chosen to prevent data loss Ran make format
This commit is contained in:
parent
71085838db
commit
99a2d66086
9 changed files with 211 additions and 122 deletions
|
@ -22,6 +22,9 @@
|
|||
#include "core/Clock.h"
|
||||
#include "core/Config.h"
|
||||
#include "gui/Clipboard.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
#include <QShortcut>
|
||||
|
||||
TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
|
||||
: QDialog(parent)
|
||||
|
@ -39,6 +42,7 @@ TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
|
|||
resetCounter();
|
||||
updateProgressBar();
|
||||
|
||||
connect(parent, SIGNAL(lockedDatabase()), SLOT(close()));
|
||||
connect(&m_totpUpdateTimer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));
|
||||
connect(&m_totpUpdateTimer, SIGNAL(timeout()), this, SLOT(updateSeconds()));
|
||||
m_totpUpdateTimer.start(m_step * 10);
|
||||
|
@ -46,6 +50,8 @@ TotpDialog::TotpDialog(QWidget* parent, Entry* entry)
|
|||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
new QShortcut(QKeySequence(QKeySequence::Copy), this, SLOT(copyToClipboard()));
|
||||
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Copy"));
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
||||
|
@ -61,9 +67,9 @@ void TotpDialog::copyToClipboard()
|
|||
clipboard()->setText(m_entry->totp());
|
||||
if (config()->get("HideWindowOnCopy").toBool()) {
|
||||
if (config()->get("MinimizeOnCopy").toBool()) {
|
||||
qobject_cast<DatabaseWidget*>(parent())->window()->showMinimized();
|
||||
getMainWindow()->showMinimized();
|
||||
} else if (config()->get("DropToBackgroundOnCopy").toBool()) {
|
||||
qobject_cast<DatabaseWidget*>(parent())->window()->lower();
|
||||
getMainWindow()->lower();
|
||||
window()->lower();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue