Improve retry on input field detection with Custom Login Fields (#2875)

This commit is contained in:
Sami Vänttinen 2026-03-01 08:32:34 +02:00 committed by GitHub
parent bf0969aefe
commit 589b14a7cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -646,6 +646,11 @@ kpxcFields.useCustomLoginFields = async function() {
kpxcTOTPIcons.newIcon(totp, kpxc.databaseState);
}
// No values found
if (!username && !password && !totp && !submitButton && stringFields?.length === 0) {
return [];
}
const combinations = [];
combinations.push({
username: username,

View file

@ -361,7 +361,7 @@ kpxc.initCredentialFields = async function() {
// Search all remaining inputs from the page, ignore the previous input fields
const pageInputs = await kpxcFields.getAllPageInputs(formInputs);
if (formInputs.length === 0 && pageInputs.length === 0 && !kpxcFields.isCustomLoginFieldsUsed()) {
if (formInputs.length === 0 && pageInputs.length === 0) {
// Run 'redetect_credentials' manually if no fields are found after a page load
setTimeout(async function() {
if (_called.automaticRedetectCompleted) {
@ -653,7 +653,10 @@ kpxc.retrieveCredentials = async function(force = false) {
}
kpxc.url = document.location.href;
kpxc.submitUrl = kpxc.getFormActionUrl(kpxc.combinations[0]);
// Search for first combination that has username or password input set
const firstCombination = kpxc.combinations?.find((combination) => combination?.username || combination?.password);
kpxc.submitUrl = kpxc.getFormActionUrl(firstCombination);
if (kpxc.settings.autoRetrieveCredentials && kpxc.url && kpxc.submitUrl) {
await kpxc.retrieveCredentialsCallback(