mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #534 from keepassxreboot/fix/auto_submit
Fix auto-submit
This commit is contained in:
commit
d7a49c675e
1 changed files with 18 additions and 4 deletions
|
|
@ -1339,12 +1339,26 @@ kpxc.fillIn = function(combination, onlyPassword, suppressWarnings) {
|
|||
}
|
||||
}
|
||||
|
||||
// Get the form submit button instead if action URL is same as the page itself
|
||||
function getSubmitButton(form) {
|
||||
if (kpxc.submitUrl === document.location.origin + document.location.pathname) {
|
||||
for (const i of form.elements) {
|
||||
if (i.type === 'submit') {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Auto-submit
|
||||
if (kpxc.settings.autoSubmit) {
|
||||
if (kpxc.u.form) {
|
||||
kpxc.u.form.submit();
|
||||
} else if (kpxc.p.form) {
|
||||
kpxc.u.form.submit();
|
||||
const form = kpxc.u.form || kpxc.p.form;
|
||||
const submitButton = getSubmitButton(form);
|
||||
if (submitButton !== undefined) {
|
||||
submitButton.click();
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue