mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2227 from keepassxreboot/fix/show_group_name_in_credential_menu
Show group name in Credential Banner's menu when updating a credential
This commit is contained in:
commit
232cb5bd1c
1 changed files with 12 additions and 8 deletions
|
|
@ -146,6 +146,12 @@ kpxc.getDocumentLocation = function() {
|
|||
return kpxc.settings.saveDomainOnly ? document.location.origin : document.location.href;
|
||||
};
|
||||
|
||||
kpxc.getUniqueGroupCount = function(creds) {
|
||||
const groups = creds.map(c => c.group || '');
|
||||
const uniqueGroups = new Set(groups);
|
||||
return uniqueGroups.size;
|
||||
};
|
||||
|
||||
// Returns the form that includes the inputField
|
||||
kpxc.getForm = function(inputField) {
|
||||
if (inputField.form) {
|
||||
|
|
@ -391,13 +397,8 @@ kpxc.initLoginPopup = function() {
|
|||
: first.localeCompare(second);
|
||||
};
|
||||
|
||||
const getUniqueGroupCount = function(creds) {
|
||||
const groups = creds.map(c => c.group || '');
|
||||
const uniqueGroups = new Set(groups);
|
||||
return uniqueGroups.size;
|
||||
};
|
||||
|
||||
const showGroupNameInAutocomplete = kpxc.settings.showGroupNameInAutocomplete && (getUniqueGroupCount(kpxc.credentials) > 1);
|
||||
const showGroupNameInAutocomplete =
|
||||
kpxc.settings.showGroupNameInAutocomplete && kpxc.getUniqueGroupCount(kpxc.credentials) > 1;
|
||||
|
||||
// Initialize login items
|
||||
const loginItems = [];
|
||||
|
|
@ -506,10 +507,13 @@ kpxc.rememberCredentials = async function(usernameValue, passwordValue, urlValue
|
|||
}
|
||||
}
|
||||
|
||||
const showGroupNameInAutocomplete =
|
||||
kpxc.settings.showGroupNameInAutocomplete && kpxc.getUniqueGroupCount(credentials) > 1;
|
||||
|
||||
const credentialsList = [];
|
||||
for (const c of credentials) {
|
||||
credentialsList.push({
|
||||
login: c.login,
|
||||
login: showGroupNameInAutocomplete ? `[${c.group}] ${c.login}` : c.login,
|
||||
name: c.name,
|
||||
uuid: c.uuid
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue