Merge pull request #1015 from keepassxreboot/fix/auto_submit_with_google

Fix Google login page submit
This commit is contained in:
Sami Vänttinen 2020-10-12 07:05:34 +03:00 committed by GitHub
commit 6cff401638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -201,7 +201,10 @@ kpxcAutocomplete.keyPress = function(e) {
}
kpxcAutocomplete.index = kpxcAutocomplete.elements.findIndex(c => c.value === kpxcAutocomplete.input.value);
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index, kpxcAutocomplete.elements[kpxcAutocomplete.index].uuid);
if (kpxcAutocomplete.index >= 0) {
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index, kpxcAutocomplete.elements[kpxcAutocomplete.index].uuid);
}
kpxcAutocomplete.closeList();
} else if (e.key === 'Escape') {
kpxcAutocomplete.closeList();

View file

@ -156,6 +156,18 @@ kpxcForm.getCredentialFieldsFromForm = function(form) {
// Get the form submit button instead if action URL is same as the page itself
kpxcForm.getFormSubmitButton = function(form) {
const action = kpxc.submitUrl || form.action;
// Special handling for accounts.google.com. The submit button is outside the form.
if (form.action.startsWith('https://accounts.google.com')) {
const findDiv = $('#identifierNext');
if (!findDiv) {
return undefined;
}
const buttons = findDiv.getElementsByTagName('button');
return buttons.length > 0 ? buttons[0] : undefined;
}
if (action.includes(document.location.origin + document.location.pathname)) {
for (const i of form.elements) {
if (i.type === 'submit') {