0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-20 04:12:15 +02:00

Allow CSV import of bare TOTP secrets

Fixes #6167
This commit is contained in:
Guillaume Turchini 2021-03-01 03:18:53 +01:00 committed by Jonathan White
parent e29cf8bfef
commit 8b8fb9562f

View File

@ -208,8 +208,13 @@ void CsvImportWidget::writeDatabase()
entry->setUrl(m_parserModel->data(m_parserModel->index(r, 4)).toString());
entry->setNotes(m_parserModel->data(m_parserModel->index(r, 5)).toString());
if (m_parserModel->data(m_parserModel->index(r, 6)).isValid()) {
auto totp = Totp::parseSettings(m_parserModel->data(m_parserModel->index(r, 6)).toString());
auto otpString = m_parserModel->data(m_parserModel->index(r, 6));
if (otpString.isValid() && !otpString.toString().isEmpty()) {
auto totp = Totp::parseSettings(otpString.toString());
if (totp->key.isEmpty()) {
// Bare secret, use default TOTP settings
totp = Totp::parseSettings({}, otpString.toString());
}
entry->setTotp(totp);
}