Merge pull request #2525 from keepassxreboot/fix/credential_banner_improvement

Improve username input detection with Credential Banner
This commit is contained in:
Sami Vänttinen 2025-04-23 06:24:52 +03:00 committed by GitHub
commit a2748198b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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);
};