Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Ulich <ulich@users.noreply.github.com>2020-02-20 18:31:21 +0300
committerGitHub <noreply@github.com>2020-02-20 18:31:21 +0300
commit5dd909b779e85e4ca271ed1a7674339c6f2db38b (patch)
tree0c50099fe1ae0961434b88932a96e8d809580003 /keepassxc-browser
parent70de3bb7a602fe8f007e834df1cd160d323ffbca (diff)
Show the group name in autocomplete (#739)
Show the group name in autocomplete
Diffstat (limited to 'keepassxc-browser')
-rw-r--r--keepassxc-browser/_locales/en/messages.json8
-rwxr-xr-xkeepassxc-browser/background/page.js5
-rwxr-xr-xkeepassxc-browser/content/keepassxc-browser.js17
-rw-r--r--keepassxc-browser/options/options.html8
4 files changed, 34 insertions, 4 deletions
diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json
index 0e4fbb9..798f155 100644
--- a/keepassxc-browser/_locales/en/messages.json
+++ b/keepassxc-browser/_locales/en/messages.json
@@ -607,6 +607,10 @@
"message": "Activate autocomplete for username fields.",
"description": "Activate autocomplete for username fields checkbox text."
},
+ "optionsCheckboxShowGroupNameInAutocomplete": {
+ "message": "Display the group name in autocomplete list when credentials are from different groups.",
+ "description": "Show group name in autocomplete checkbox text."
+ },
"optionsCheckboxAutoSubmit": {
"message": "Auto-submit login forms",
"description": "Auto-submit checkbox text."
@@ -719,6 +723,10 @@
"message": "Show a dropdown list containing available credentials for all username fields on a page.",
"description": "Autocomplete Usernames option help text."
},
+ "optionsShowGroupNameInAutocompleteHelpText": {
+ "message": "When credentials are returned from different groups, the group name will be shown.",
+ "description": "Show group name in autocomplete help text."
+ },
"optionsShowNotificationsHelpText": {
"message": "Show notifications for errors and when user interaction is required.",
"description": "Show notifications option help text."
diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js
index 3d9e4a0..38ec9bc 100755
--- a/keepassxc-browser/background/page.js
+++ b/keepassxc-browser/background/page.js
@@ -2,6 +2,7 @@
const defaultSettings = {
autoCompleteUsernames: true,
+ showGroupNameInAutocomplete: true,
autoFillAndSend: false,
autoFillSingleEntry: false,
autoReconnect: false,
@@ -41,6 +42,10 @@ page.initSettings = async function() {
page.settings.autoCompleteUsernames = defaultSettings.autoCompleteUsernames;
}
+ if (!('showGroupNameInAutocomplete' in page.settings)) {
+ page.settings.showGroupNameInAutocomplete = defaultSettings.showGroupNameInAutocomplete;
+ }
+
if (!('autoFillAndSend' in page.settings)) {
page.settings.autoFillAndSend = defaultSettings.autoFillAndSend;
}
diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js
index 405c03a..329cf49 100755
--- a/keepassxc-browser/content/keepassxc-browser.js
+++ b/keepassxc-browser/content/keepassxc-browser.js
@@ -1121,19 +1121,28 @@ kpxc.preparePageForMultipleCredentials = function(credentials) {
return;
}
- function getLoginText(credential) {
+ function getLoginText(credential, withGroup) {
+ const group = (withGroup && credential.group) ? `[${credential.group}] ` : '';
const visibleLogin = (credential.login.length > 0) ? credential.login : tr('credentialsNoUsername');
+ const text = `${group}${credential.name} (${visibleLogin})`;
if (credential.expired && credential.expired === 'true') {
- return `${visibleLogin} (${credential.name}) [${tr('credentialExpired')}]`;
+ return `${text} [${tr('credentialExpired')}]`;
}
- return `${visibleLogin} (${credential.name})`;
+ return text;
+ }
+
+ function getUniqueGroupCount(credentials) {
+ const groups = credentials.map(c => c.group || '')
+ const uniqueGroups = new Set(groups)
+ return uniqueGroups.size
}
// Add usernames + descriptions to autocomplete-list and popup-list
const usernames = [];
kpxcAutocomplete.elements = [];
+ const showGroupNameInAutocomplete = kpxc.settings.showGroupNameInAutocomplete && (getUniqueGroupCount(credentials) > 1)
for (let i = 0; i < credentials.length; i++) {
- const loginText = getLoginText(credentials[i]);
+ const loginText = getLoginText(credentials[i], showGroupNameInAutocomplete);
usernames.push(loginText);
const item = {
diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html
index 3679347..198d809 100644
--- a/keepassxc-browser/options/options.html
+++ b/keepassxc-browser/options/options.html
@@ -157,6 +157,14 @@
<span class="help-block" data-i18n="optionsAutocompleteUsernamesHelpText"></span>
</div>
</p>
+ <p>
+ <div class="checkbox">
+ <label class="checkbox">
+ <input type="checkbox" name="showGroupNameInAutocomplete" value="true" /><span data-i18n="optionsCheckboxShowGroupNameInAutocomplete"></span>
+ </label>
+ <span class="help-block" data-i18n="optionsShowGroupNameInAutocompleteHelpText"></span>
+ </div>
+ </p>
<hr />
<p>
<div class="checkbox">