Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarjolintu <sami.vanttinen@protonmail.com>2020-05-22 08:27:15 +0300
committervarjolintu <sami.vanttinen@protonmail.com>2020-05-22 08:27:15 +0300
commit50fd3eb9168b3005c01680793a9835f6b8b70947 (patch)
treea32aab2a4759ae61014586c7dbc27f7cd7d6e77f /keepassxc-browser
parent1ef4543f9555f709f9f1cabe01785cf7b80af14a (diff)
Add support for div role button with forms
Diffstat (limited to 'keepassxc-browser')
-rwxr-xr-xkeepassxc-browser/content/keepassxc-browser.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js
index b5f6231..a69896d 100755
--- a/keepassxc-browser/content/keepassxc-browser.js
+++ b/keepassxc-browser/content/keepassxc-browser.js
@@ -133,7 +133,18 @@ kpxcForm.onSubmit = async function(e) {
return;
}
- const form = this.nodeName === 'FORM' ? this : this.form;
+ const searchForm = f => {
+ if (f.nodeName === 'FORM') {
+ return f;
+ }
+ };
+
+ // Traverse parents if the form is not found.
+ const form = this.nodeName === 'FORM' ? this : kpxcFields.traverseParents(this, searchForm, searchForm, () => null);
+ if (!form) {
+ return;
+ }
+
const usernameId = form.getAttribute('kpxcUsername');
const passwordId = form.getAttribute('kpxcPassword');
const usernameField = _f(usernameId);
@@ -1266,6 +1277,8 @@ kpxc.getFormActionUrlFromSingleInput = function(field) {
return action;
};
+const formButtonQuery = 'button[type=\'button\'], button[type=\'submit\'], input[type=\'button\'], button:not([type]), div[role=\'button\']';
+
// Get the form submit button instead if action URL is same as the page itself
kpxc.getFormSubmitButton = function(form) {
const action = kpxc.submitUrl || form.action;
@@ -1278,7 +1291,7 @@ kpxc.getFormSubmitButton = function(form) {
}
// Try to find another button. Select the first one.
- const buttons = Array.from(form.querySelectorAll('button[type=\'button\'], button[type=\'submit\'], input[type=\'button\'], button:not([type])'));
+ const buttons = Array.from(form.querySelectorAll(formButtonQuery));
if (buttons.length > 0) {
return buttons[0];
}