Passkeys: Fix duplicate database selection

This commit is contained in:
varjolintu 2024-04-21 08:56:38 +03:00 committed by Jonathan White
parent 6f11422604
commit 41d00135af
3 changed files with 8 additions and 6 deletions

View File

@ -666,7 +666,8 @@ QJsonObject BrowserService::showPasskeysRegisterPrompt(const QJsonObject& public
userId,
publicKeyCredentials.key);
} else {
addPasskeyToGroup(nullptr,
addPasskeyToGroup(db,
nullptr,
origin,
rpId,
rpName,
@ -689,7 +690,7 @@ QJsonObject BrowserService::showPasskeysAuthenticationPrompt(const QJsonObject&
const QString& origin,
const StringPairList& keyList)
{
auto db = selectedDatabase();
auto db = getDatabase();
if (!db) {
return getPasskeyError(ERROR_KEEPASS_DATABASE_NOT_OPENED);
}
@ -738,7 +739,8 @@ QJsonObject BrowserService::showPasskeysAuthenticationPrompt(const QJsonObject&
return getPasskeyError(ERROR_PASSKEYS_REQUEST_CANCELED);
}
void BrowserService::addPasskeyToGroup(Group* group,
void BrowserService::addPasskeyToGroup(const QSharedPointer<Database>& db,
Group* group,
const QString& url,
const QString& rpId,
const QString& rpName,
@ -749,7 +751,6 @@ void BrowserService::addPasskeyToGroup(Group* group,
{
// If no group provided, use the default browser group of the selected database
if (!group) {
auto db = selectedDatabase();
if (!db) {
return;
}

View File

@ -94,7 +94,8 @@ public:
QJsonObject showPasskeysAuthenticationPrompt(const QJsonObject& publicKeyOptions,
const QString& origin,
const StringPairList& keyList);
void addPasskeyToGroup(Group* group,
void addPasskeyToGroup(const QSharedPointer<Database>& db,
Group* group,
const QString& url,
const QString& rpId,
const QString& rpName,

View File

@ -152,7 +152,7 @@ void PasskeyImporter::showImportDialog(QSharedPointer<Database>& database,
}
browserService()->addPasskeyToGroup(
group, url, relyingParty, relyingParty, username, credentialId, userHandle, privateKey);
db, group, url, relyingParty, relyingParty, username, credentialId, userHandle, privateKey);
}
Group* PasskeyImporter::getDefaultGroup(QSharedPointer<Database>& database) const