mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-25 01:03:35 -05:00
Fix OPVault import when there are multiple OTP fields
* Fix #8371 - store multiple OTP fields as `otp_#` instead of silently discarding them.
This commit is contained in:
parent
28328a7080
commit
f3d448485a
2 changed files with 20 additions and 1 deletions
|
|
@ -84,7 +84,16 @@ void OpVaultReader::fillFromSectionField(Entry* entry, const QString& sectionNam
|
|||
auto kind = field["k"].toString();
|
||||
|
||||
if (attrName.startsWith("TOTP_")) {
|
||||
if (attrValue.startsWith("otpauth://")) {
|
||||
if (entry->hasTotp()) {
|
||||
// Store multiple TOTP definitions as additional otp attributes
|
||||
int i = 0;
|
||||
QString name("otp");
|
||||
auto attributes = entry->attributes()->keys();
|
||||
while (attributes.contains(name)) {
|
||||
name = QString("otp_%1").arg(++i);
|
||||
}
|
||||
entry->attributes()->set(name, attrValue);
|
||||
} else if (attrValue.startsWith("otpauth://")) {
|
||||
QUrlQuery query(attrValue);
|
||||
// at least as of 1Password 7, they don't append the digits= and period= which totp.cpp requires
|
||||
if (!query.hasQueryItem("digits")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue