Fix Google login page submit

This commit is contained in:
varjolintu 2020-09-16 20:48:29 +03:00
parent c90cff8f65
commit 5586f460b7
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') {