Merge pull request #1099 from keepassxreboot/fix/extra_check_for_form_action

Add extra checks for form.action
This commit is contained in:
Sami Vänttinen 2020-11-07 17:21:03 +02:00 committed by GitHub
commit 376510c3f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,6 +155,10 @@ kpxcForm.getCredentialFieldsFromForm = function(form) {
// Get the form submit button instead if action URL is same as the page itself
kpxcForm.getFormSubmitButton = function(form) {
if (!form.action || typeof form.action !== 'string') {
return;
}
const action = kpxc.submitUrl || form.action;
// Special handling for accounts.google.com. The submit button is outside the form.
@ -221,6 +225,10 @@ kpxcForm.getNewPassword = function(passwordInputs = []) {
// Initializes form and attaches the submit button to our own callback
kpxcForm.init = function(form, credentialFields) {
if (!form.action || typeof form.action !== 'string') {
return;
}
if (!kpxcForm.formIdentified(form) && (credentialFields.password || credentialFields.username)
|| form.action.startsWith(kpxcSites.googlePasswordFormUrl)) {
kpxcForm.saveForm(form, credentialFields);