Complete refactor of TOTP integration
* Eliminate TOTP logic from GUI elements * Consolidate TOTP functionality under the Totp namespace * Eliminate guessing about state and encoders * Increased test cases * Add entry view column for TOTP [#2132] * General code cleanup, reduction of unnecessary steps, separation of concerns * Rename SetupTotpDialog to TotpSetupDialog for consistency
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
#include "gui/DetailsWidget.h"
|
||||
#include "gui/KeePass1OpenWidget.h"
|
||||
#include "gui/MessageBox.h"
|
||||
#include "gui/SetupTotpDialog.h"
|
||||
#include "gui/TotpSetupDialog.h"
|
||||
#include "gui/TotpDialog.h"
|
||||
#include "gui/UnlockDatabaseDialog.h"
|
||||
#include "gui/UnlockDatabaseWidget.h"
|
||||
@@ -444,15 +444,8 @@ void DatabaseWidget::setupTotp()
|
||||
return;
|
||||
}
|
||||
|
||||
auto setupTotpDialog = new SetupTotpDialog(this, currentEntry);
|
||||
if (currentEntry->hasTotp()) {
|
||||
setupTotpDialog->setSeed(currentEntry->totpSeed());
|
||||
setupTotpDialog->setStep(currentEntry->totpStep());
|
||||
setupTotpDialog->setDigits(currentEntry->totpDigits());
|
||||
// now that all settings are set, decide whether it's default, steam or custom
|
||||
setupTotpDialog->setSettings(currentEntry->totpDigits());
|
||||
}
|
||||
|
||||
auto setupTotpDialog = new TotpSetupDialog(this, currentEntry);
|
||||
connect(setupTotpDialog, SIGNAL(totpUpdated()), SIGNAL(entrySelectionChanged()));
|
||||
setupTotpDialog->open();
|
||||
}
|
||||
|
||||
@@ -938,6 +931,13 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod
|
||||
openUrlForEntry(entry);
|
||||
}
|
||||
break;
|
||||
case EntryModel::Totp:
|
||||
if (entry->hasTotp()) {
|
||||
setClipboardTextAndMinimize(entry->totp());
|
||||
} else {
|
||||
setupTotp();
|
||||
}
|
||||
break;
|
||||
// TODO: switch to 'Notes' tab in details view/pane
|
||||
// case EntryModel::Notes:
|
||||
// break;
|
||||
|
||||
Reference in New Issue
Block a user