Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-fill will be applied if related credentials are available #2409

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions keepassxc-browser/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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": "Let KeePassXC-Browser automatically fill in credentials if it receives relevant credential.",
varjolintu marked this conversation as resolved.
Show resolved Hide resolved
"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."
Expand All @@ -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.",
Expand Down Expand Up @@ -1089,7 +1097,7 @@
"optionsColumnAllowIframes": {
"message": "Allow Cross-Origin iframes",
"description": "Allow iframes column text."
},
},
"optionsColumnDelete": {
"message": "Delete",
"description": "Site Preferences list column title."
Expand Down
1 change: 1 addition & 0 deletions keepassxc-browser/background/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const defaultSettings = {
autoCompleteUsernames: true,
autoFillAndSend: false,
autoFillSingleEntry: false,
autoFillRelevantCredential: false,
autoFillSingleTotp: false,
autoReconnect: false,
autoRetrieveCredentials: true,
Expand Down
11 changes: 11 additions & 0 deletions keepassxc-browser/content/keepassxc-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if (relevantCredential) {
const index = kpxc.combinations.length - 1;
varjolintu marked this conversation as resolved.
Show resolved Hide resolved
kpxcFill.fillInCredentials(kpxc.combinations[index], relevantCredential.login, relevantCredential.uuid);
}
}
}
};

/**
Expand Down
4 changes: 4 additions & 0 deletions keepassxc-browser/managed_storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions keepassxc-browser/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ <h2 class="pb-3 mt-0" data-i18n="optionsGeneralSettingsTab"></h2>
</div>
<div>
<span class="form-text text-muted" data-i18n="optionsFillSortPriorityHelpText"></span>
<div class="form-check mt-2">
<input class="form-check-input" type="checkbox" name="autoFillRelevantCredential" id="autoFillRelevantCredential" value="true">
<label class="form-check-label" for="autoFillRelevantCredential" data-i18n="optionsCheckboxAutoFillRelevantCredential"></label>
<div class="form-text" data-i18n="optionsAutoFillRelevantCredentialHelpText"></div>
</div>
</div>

<!-- Credential sorting after fill for TOTP -->
Expand Down Expand Up @@ -246,6 +251,7 @@ <h2 class="pb-3 mt-0" data-i18n="optionsGeneralSettingsTab"></h2>
<input class="form-check-input" type="checkbox" name="autoFillSingleEntry" id="autoFillSingleEntry" value="true">
<label class="form-check-label" for="autoFillSingleEntry" data-i18n="optionsCheckboxAutoFillSingleEntry"></label>
<div class="form-text" data-i18n="optionsAutoFillSingleEntryHelpText"></div>

<div class="alert alert-warning mt-3 col-lg-9" role="alert">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
<span data-i18n="optionsAutoFillSingleEntryWarning"></span>
Expand Down