Improve username input detection with Credential Banner

This commit is contained in:
varjolintu 2025-04-22 16:53:10 +03:00
parent dccf307e0c
commit 064d27bf0a

View file

@ -229,7 +229,11 @@ kpxcForm.onSubmit = async function(e) {
}
const [ usernameField, passwordField, passwordInputs ] = kpxcForm.getCredentialFieldsFromForm(form);
const usernameValue = await kpxcForm.getUsernameValue(usernameField);
// Use the first text field in the form if only username input is missing
const usernameValue = await kpxcForm.getUsernameValue(!usernameField && passwordField
? form?.querySelector('input[type=text]')
: usernameField);
await kpxcForm.activateCredentialBanner(usernameValue, passwordInputs, passwordField);
};