mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Use active element on fillFromCombination()
This commit is contained in:
parent
f3379e6677
commit
29991bf8ea
1 changed files with 6 additions and 6 deletions
|
|
@ -30,26 +30,26 @@ 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.');
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue