mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-10-31 22:49:14 -04:00
Support key files with Auto Open feature
Fixes #3495 * Look for keyfile in username parameter of the Auto Open entries. If present, pass on to unlock call to the database.
This commit is contained in:
parent
0a75b47509
commit
72c1783b5b
4 changed files with 36 additions and 9 deletions
|
|
@ -987,10 +987,8 @@ void DatabaseWidget::unlockDatabase(bool accepted)
|
|||
}
|
||||
replaceDatabase(db);
|
||||
if (db->isReadOnly()) {
|
||||
showMessage(tr("This database is opened in read-only mode. Autosave is disabled."),
|
||||
MessageWidget::Warning,
|
||||
false,
|
||||
-1);
|
||||
showMessage(
|
||||
tr("This database is opened in read-only mode. Autosave is disabled."), MessageWidget::Warning, false, -1);
|
||||
}
|
||||
|
||||
restoreGroupEntryFocus(m_groupBeforeLock, m_entryBeforeLock);
|
||||
|
|
@ -1740,6 +1738,8 @@ void DatabaseWidget::processAutoOpen()
|
|||
continue;
|
||||
}
|
||||
QFileInfo filepath;
|
||||
QFileInfo keyfile;
|
||||
|
||||
if (entry->url().startsWith("file://")) {
|
||||
QUrl url(entry->url());
|
||||
filepath.setFile(url.toLocalFile());
|
||||
|
|
@ -1755,7 +1755,20 @@ void DatabaseWidget::processAutoOpen()
|
|||
continue;
|
||||
}
|
||||
|
||||
// Request to open the database file in the background
|
||||
emit requestOpenDatabase(filepath.canonicalFilePath(), true, entry->password());
|
||||
if (!entry->username().isEmpty()) {
|
||||
if (entry->username().startsWith("file://")) {
|
||||
QUrl keyfileUrl(entry->username());
|
||||
keyfile.setFile(keyfileUrl.toLocalFile());
|
||||
} else {
|
||||
keyfile.setFile(entry->username());
|
||||
if (keyfile.isRelative()) {
|
||||
QFileInfo currentpath(m_db->filePath());
|
||||
keyfile.setFile(currentpath.absoluteDir(), entry->username());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Request to open the database file in the background with a password and keyfile
|
||||
emit requestOpenDatabase(filepath.canonicalFilePath(), true, entry->password(), keyfile.canonicalFilePath());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue