add hack for submitting a login form containing an element with name or id "submit", which masks the form submit() method

This commit is contained in:
Noah Levitt 2016-12-20 11:24:26 -08:00
parent b24b229cb2
commit 06fd0a0d79

View file

@ -561,7 +561,15 @@ var __brzl_tryLogin = function() {
passwordField.value = {{password|json}};
console.log('submitting username=' + usernameField.value
+ ' password=*** to detected login form');
try {
form.submit();
} catch (e) {
// "If a form control (such as a submit button) has a name or
// id of 'submit' it will mask the form's submit method." -MDN
// http://stackoverflow.com/a/2000021
var pseudoForm = document.createElement('form');
pseudoForm.submit.apply(form);
}
__brzl_tryLoginState = 'submitted-form';
return;
}