From 5eac65ec85a35a3ebe098409b6de3341a6dcd84b Mon Sep 17 00:00:00 2001 From: varjolintu Date: Fri, 22 Jan 2021 15:57:24 +0200 Subject: [PATCH] Ignore buttons with different formaction --- keepassxc-browser/content/keepassxc-browser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index d02754b..7125fa9 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -189,8 +189,9 @@ kpxcForm.getFormSubmitButton = function(form) { } // Try to find another button. Select the last one. - // TODO: Possibly change this behavior to select the last one for only certain sites. - const buttons = Array.from(form.querySelectorAll(kpxcForm.formButtonQuery)); + // If any formaction overriding the default action is set, ignore those buttons. + const buttons = Array.from(form.querySelectorAll(kpxcForm.formButtonQuery)) + .filter(b => b.formAction === document.location.href); if (buttons.length > 0) { return buttons[buttons.length - 1]; }