Add support for skip Auto-Submit property

This commit is contained in:
varjolintu 2019-08-15 12:34:26 +03:00
parent 6b9d891a79
commit 4a9613f6bb

View file

@ -1230,12 +1230,18 @@ kpxc.fillIn = function(combination, onlyPassword, suppressWarnings) {
return;
}
let skipAutoSubmit = false;
const uField = _f(combination.username);
const pField = _f(combination.password);
// Exactly one pair of credentials available
if (kpxc.credentials.length === 1) {
let filledIn = false;
if (kpxc.credentials[0].skipAutoSubmit !== undefined) {
skipAutoSubmit = kpxc.credentials[0].skipAutoSubmit === 'true';
}
if (uField && (!onlyPassword || _singleInputEnabledForPage)) {
kpxc.setValueWithChange(uField, kpxc.credentials[0].login);
browser.runtime.sendMessage({
@ -1272,6 +1278,11 @@ kpxc.fillIn = function(combination, onlyPassword, suppressWarnings) {
} else if (combination.loginId !== undefined && kpxc.credentials[combination.loginId]) {
// Specific login ID given
let filledIn = false;
if (kpxc.credentials[0].skipAutoSubmit !== undefined) {
skipAutoSubmit = kpxc.credentials[combination.loginId].skipAutoSubmit === 'true';
}
if (uField && (!onlyPassword || _singleInputEnabledForPage)) {
kpxc.setValueWithChange(uField, kpxc.credentials[combination.loginId].login);
browser.runtime.sendMessage({
@ -1322,6 +1333,10 @@ kpxc.fillIn = function(combination, onlyPassword, suppressWarnings) {
valPassword = c.password;
valUsername = c.login;
valStringFields = c.stringFields;
if (c.skipAutoSubmit !== undefined) {
skipAutoSubmit = c.skipAutoSubmit === 'true';
}
}
}
@ -1384,7 +1399,7 @@ kpxc.fillIn = function(combination, onlyPassword, suppressWarnings) {
}
// Auto-submit
if (kpxc.settings.autoSubmit) {
if (kpxc.settings.autoSubmit && !skipAutoSubmit) {
const form = kpxc.u.form || kpxc.p.form;
const submitButton = kpxc.getSubmitButton(form);
if (submitButton !== undefined) {