Increase max TOTP step to 24 hours

* Fixes #7095
This commit is contained in:
Jonathan White 2023-02-21 22:26:06 -05:00
parent 3bbaeab278
commit ba1bbd3b52
4 changed files with 9 additions and 2 deletions

View File

@ -29,6 +29,7 @@ TotpSetupDialog::TotpSetupDialog(QWidget* parent, Entry* entry)
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
setFixedSize(sizeHint());
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));

View File

@ -163,7 +163,7 @@
<number>1</number>
</property>
<property name="maximum">
<number>60</number>
<number>86400</number>
</property>
<property name="value">
<number>30</number>

View File

@ -114,7 +114,7 @@ QSharedPointer<Totp::Settings> Totp::parseSettings(const QString& rawSettings, c
// Bound digits and step
settings->digits = qBound(1u, settings->digits, 10u);
settings->step = qBound(1u, settings->step, 60u);
settings->step = qBound(1u, settings->step, 86400u);
// Detect custom settings, used by setup GUI
if (settings->encoder.shortName.isEmpty()

View File

@ -59,6 +59,12 @@ void TestTotp::testParseSecret()
QCOMPARE(settings->step, 30u);
QCOMPARE(settings->algorithm, Totp::Algorithm::Sha512);
// Max TOTP step of 24-hours
secret.replace("period=30", "period=90000");
settings = Totp::parseSettings(secret);
QVERIFY(!settings.isNull());
QCOMPARE(settings->step, 86400u);
// KeeOTP Parsing
secret = "key=HXDMVJECJJWSRBY%3d&step=25&size=8&otpHashMode=Sha256";
settings = Totp::parseSettings(secret);