Fix updating reference passwords from KeePassXC-Browser (#2218)

* Allow updating reference passwords

* Fix function change after refactor
This commit is contained in:
Sami Vänttinen 2019-01-21 21:24:57 +02:00 committed by Jonathan White
parent 94430c300b
commit 0da9efdbd4
4 changed files with 35 additions and 1 deletions

View file

@ -371,6 +371,17 @@ void BrowserService::updateEntry(const QString& id,
return;
}
// Check if the entry password is a reference. If so, update the original entry instead
while (entry->attributes()->isReference(EntryAttributes::PasswordKey)) {
const QUuid referenceUuid = entry->attributes()->referenceUuid(EntryAttributes::PasswordKey);
if (!referenceUuid.isNull()) {
entry = db->rootGroup()->findEntryByUuid(referenceUuid);
if (!entry) {
return;
}
}
}
QString username = entry->username();
if (username.isEmpty()) {
return;
@ -391,7 +402,9 @@ void BrowserService::updateEntry(const QString& id,
if (browserSettings()->alwaysAllowUpdate() || dialogResult == MessageBox::Save) {
entry->beginUpdate();
entry->setUsername(login);
if (!entry->attributes()->isReference(EntryAttributes::UserNameKey)) {
entry->setUsername(login);
}
entry->setPassword(password);
entry->endUpdate();
}