mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1985 from keepassxreboot/fix/fill_from_combination
Use active element on fillFromCombination()
This commit is contained in:
commit
796dd931d5
1 changed files with 7 additions and 7 deletions
|
|
@ -30,28 +30,28 @@ kpxcFill.fillInFromActiveElement = async function(passOnly = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
const elem = document.activeElement;
|
||||
if (kpxc.combinations.length > 0) {
|
||||
if (await kpxcFill.fillFromCombination(passOnly)) {
|
||||
if (await kpxcFill.fillFromCombination(elem, passOnly)) {
|
||||
// Combination found and filled
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No previous combinations detected. Create a new one from active element
|
||||
const el = document.activeElement;
|
||||
const combination = await kpxc.createCombination(el, passOnly);
|
||||
const combination = await kpxc.createCombination(elem, passOnly);
|
||||
|
||||
await sendMessage('page_set_login_id', kpxc.credentials[0].uuid);
|
||||
kpxcFill.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid, passOnly);
|
||||
};
|
||||
|
||||
// Fill from combination, if found
|
||||
kpxcFill.fillFromCombination = async function(passOnly) {
|
||||
kpxcFill.fillFromCombination = async function(elem, passOnly) {
|
||||
const combination = passOnly
|
||||
? kpxc.combinations.find(c => c.password)
|
||||
: kpxc.combinations.find(c => c.username);
|
||||
? kpxc.combinations.find(c => c.password === elem)
|
||||
: kpxc.combinations.find(c => c.username === elem);
|
||||
if (!combination) {
|
||||
logDebug('Error: No combination found.');
|
||||
logDebug('Error: No username/password field combination found.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue