Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Turchini <orion+github@orion78.fr>2021-03-01 05:18:53 +0300
committerJonathan White <support@dmapps.us>2021-05-30 15:44:09 +0300
commitb47272a5ce1ef391d881f8e5168afe0a8a96a6d6 (patch)
treedc4bd05ad9d0378deb3264ff3ac1406126ee8aa4
parentae20ee61be12efa9465de2baf7611d2ddf9d4f5c (diff)
Allow CSV import of bare TOTP secrets
Fixes #6167
-rw-r--r--src/gui/csvImport/CsvImportWidget.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/csvImport/CsvImportWidget.cpp b/src/gui/csvImport/CsvImportWidget.cpp
index e78e9f94a..809fc6e53 100644
--- a/src/gui/csvImport/CsvImportWidget.cpp
+++ b/src/gui/csvImport/CsvImportWidget.cpp
@@ -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);
}