diff --git a/keepassxc-browser/content/credential-autocomplete.js b/keepassxc-browser/content/credential-autocomplete.js index 7c86a5d..68d4a89 100644 --- a/keepassxc-browser/content/credential-autocomplete.js +++ b/keepassxc-browser/content/credential-autocomplete.js @@ -38,7 +38,7 @@ CredentialAutocomplete.prototype.fillPassword = async function(value, index, uui const combination = await kpxcFields.getCombination(this.input); combination.loginId = index; - await sendMessage('page_set_login_id', index); + await sendMessage('page_set_login_id', uuid); const manualFill = await sendMessage('page_get_manual_fill'); await kpxc.fillInCredentials(combination, value, uuid, manualFill === ManualFill.PASSWORD); diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index c391154..705d539 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -920,7 +920,7 @@ kpxc.fillInFromActiveElement = async function(passOnly = false) { return; } - await sendMessage('page_set_login_id', 0); + await sendMessage('page_set_login_id', ''); kpxc.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid, passOnly); }; @@ -931,7 +931,7 @@ kpxc.fillFromAutofill = async function() { } const index = kpxc.combinations.length - 1; - await sendMessage('page_set_login_id', 0); + await sendMessage('page_set_login_id', ''); kpxc.fillInCredentials(kpxc.combinations[index], kpxc.credentials[0].login, kpxc.credentials[0].uuid); // Generate popup-list of usernames + descriptions @@ -944,7 +944,7 @@ kpxc.fillFromPopup = async function(id, uuid) { return; } - await sendMessage('page_set_login_id', id); + await sendMessage('page_set_login_id', uuid); const selectedCredentials = kpxc.credentials.find(c => c.uuid === uuid); if (!selectedCredentials) { console.log('Error: Uuid not found: ', uuid); @@ -1041,7 +1041,7 @@ kpxc.fillFromUsernameIcon = async function(combination) { return; } - await sendMessage('page_set_login_id', 0); + await sendMessage('page_set_login_id', ''); kpxc.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid); }; @@ -1508,9 +1508,12 @@ kpxc.rememberCredentials = async function(usernameValue, passwordValue, urlValue if (credentialsList.length === 1) { usernameValue = credentialsList[0].login; } else if (credentialsList.length > 1) { - const index = await sendMessage('page_get_login_id'); - if (index >= 0) { - usernameValue = credentialsList[index].login; + const uuid = await sendMessage('page_get_login_id'); + if (uuid) { + const credsFromUuid = credentialsList.find(c => c.uuid === uuid); + if (credsFromUuid) { + usernameValue = credsFromUuid.login; + } } } } @@ -1706,20 +1709,21 @@ kpxc.updateDatabaseState = async function() { // Updates the TOTP Autocomplete Menu kpxc.updateTOTPList = async function() { - let index = await sendMessage('page_get_login_id'); - if (index < 0) { + let uuid = await sendMessage('page_get_login_id'); + if (uuid === undefined) { // Credential haven't been selected return; } // Use the first credential available if not set - if (index === undefined) { - index = 0; + if (uuid === '') { + uuid = kpxc.credentials[0].uuid; } - if (index >= 0 && kpxc.credentials[index]) { - const username = kpxc.credentials[index].login; - const password = kpxc.credentials[index].password; + const credentials = kpxc.credentials.find(c => c.uuid === uuid); + if (credentials) { + const username = credentials.login; + const password = credentials.password; // If no username is set, compare with a password const credentialList = kpxc.credentials.filter(c => (c.totp || (c.stringFields && c.stringFields.some(s => s['KPH: {TOTP}']))) diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index a5150cd..1b3b5a9 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "KeePassXC-Browser", - "version": "1.7.8", - "version_name": "1.7.8", + "version": "1.7.8.1", + "version_name": "1.7.8.1", "description": "__MSG_extensionDescription__", "author": "KeePassXC Team", "icons": { diff --git a/package.json b/package.json index 1c452b5..81e4beb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "KeePassXC-Browser", - "version": "1.7.8", + "version": "1.7.8.1", "description": "KeePassXC-Browser", "main": "build.js", "devDependencies": {