From 29991bf8ea72f60a81aca5bddbbeb9b84cb1319c Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 16 Sep 2023 10:51:56 +0300 Subject: [PATCH] Use active element on fillFromCombination() --- keepassxc-browser/content/fill.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js index f9e3ac9..b6ca1e7 100644 --- a/keepassxc-browser/content/fill.js +++ b/keepassxc-browser/content/fill.js @@ -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;