mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Create history item when setting up a TOTP seed, resolves #1445
This commit is contained in:
parent
9c51e1af18
commit
17e3f1c21f
@ -350,6 +350,7 @@ QString Entry::totp() const
|
||||
|
||||
void Entry::setTotp(const QString& seed, quint8& step, quint8& digits)
|
||||
{
|
||||
beginUpdate();
|
||||
if (step == 0) {
|
||||
step = Totp::defaultStep;
|
||||
}
|
||||
@ -376,6 +377,7 @@ void Entry::setTotp(const QString& seed, quint8& step, quint8& digits)
|
||||
}
|
||||
m_attributes->set("TOTP Settings", data);
|
||||
}
|
||||
endUpdate();
|
||||
}
|
||||
|
||||
QString Entry::totpSeed() const
|
||||
|
@ -164,3 +164,15 @@ void TestTotp::testSteamTotp()
|
||||
time = 1511200714;
|
||||
QCOMPARE(Totp::generateTotp(seed, time, Totp::ENCODER_STEAM, 30), QString("9P3VP"));
|
||||
}
|
||||
|
||||
void TestTotp::testEntryHistory()
|
||||
{
|
||||
Entry entry;
|
||||
quint8 step = 16;
|
||||
quint8 digits = 6;
|
||||
QCOMPARE(entry.historyItems().size(), 0);
|
||||
entry.setTotp("GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ", step, digits);
|
||||
QCOMPARE(entry.historyItems().size(), 1);
|
||||
entry.setTotp("foo", step, digits);
|
||||
QCOMPARE(entry.historyItems().size(), 2);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ private slots:
|
||||
void testTotpCode();
|
||||
void testEncoderData();
|
||||
void testSteamTotp();
|
||||
void testEntryHistory();
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_TESTTOTP_H
|
||||
|
Loading…
Reference in New Issue
Block a user