diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index dd598ee6..c7cc4803 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -766,6 +766,10 @@ "message": "Automatically fill in single-credential entries", "description": "Automatically fill-in single credential entry checkbox text." }, + "optionsCheckboxAutoFillRelevantCredential": { + "message": "Automatically fill in relevant credential entries", + "description": "Automatically fill-in relevant credential entry checkbox text." + }, "optionsCheckboxAutoFillSingleTotp": { "message": "Automatically fill in single TOTP entries", "description": "Automatically fill-in single TOTP entries checkbox text." @@ -914,6 +918,10 @@ "message": "Let KeePassXC-Browser automatically fill in credentials if it receives only a single entry.", "description": "Auto-Fill Single Entry option help text." }, + "optionsAutoFillRelevantCredentialHelpText": { + "message": "Automatically fill in the relevant credential if a second fill is needed.", + "description": "Auto-Fill Relevant Credential option help text." + }, "optionsAutoFillSingleEntryWarning": { "message": "Warning! Using auto-fill is not safe. Use at your own risk. KeePassXC-Browser automatically tries to detect login fields. However, they may be detected incorrectly, possibly filling sensitive data to unsafe input fields.", "description": "Auto-Fill Single Entry warning text." @@ -939,8 +947,8 @@ "description": "Use monochrome toolbar icon option help text." }, "optionsUseCompactModeHelpText": { - "message": "Use a compact version of the dropdown list to select credentials.", - "description": "Use compact (legacy) mode help text." + "message": "Use a compact version of the dropdown list to select credentials.", + "description": "Use compact (legacy) mode help text." }, "optionsSaveDomainOnlyHelpText": { "message": "When saving new credentials, save only the domain instead of full URL.", @@ -1089,7 +1097,7 @@ "optionsColumnAllowIframes": { "message": "Allow Cross-Origin iframes", "description": "Allow iframes column text." - }, + }, "optionsColumnDelete": { "message": "Delete", "description": "Site Preferences list column title." diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index 1abfb3bf..c2f8c929 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -6,6 +6,7 @@ const defaultSettings = { autoCompleteUsernames: true, autoFillAndSend: false, autoFillSingleEntry: false, + autoFillRelevantCredential: false, autoFillSingleTotp: false, autoReconnect: false, autoRetrieveCredentials: true, diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 41a051e0..380f1412 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -513,6 +513,17 @@ kpxc.prepareCredentials = async function() { kpxc.initLoginPopup(); kpxc.initAutocomplete(); + + if (kpxc.settings.autoFillRelevantCredential) { + const pageUuid = await sendMessage('page_get_login_id'); + if (pageUuid) { + const relevantCredential = kpxc.credentials.find(c => c.uuid === pageUuid); + const combination = kpxc.combinations?.at(-1); + if (relevantCredential && combination) { + kpxcFill.fillInCredentials(combination, relevantCredential.login, relevantCredential.uuid); + } + } + } }; /** diff --git a/keepassxc-browser/managed_storage.json b/keepassxc-browser/managed_storage.json index 40370eb1..21af9b8e 100644 --- a/keepassxc-browser/managed_storage.json +++ b/keepassxc-browser/managed_storage.json @@ -24,6 +24,10 @@ "title": "Automatically fill single credential entries. Default: false", "type": "boolean" }, + "autoFillRelevantCredential": { + "title": "Automatically fill relevant credential entries. Default: false", + "type": "boolean" + }, "autoFillSingleTotp": { "title": "Automatically fill single TOTP. Default: false", "type": "boolean" diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index c9eed128..3e3769c4 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -217,6 +217,11 @@