Repository navigation
Let password managers use the username on password-only login pages - #53208
Open
fbelliardtp wants to merge 1 commit into
Open
fbelliardtp wants to merge 1 commit into
fbelliardtp wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused markup changes correctly implement the requested password-manager behavior without changing submitted data.
Review effort: Balanced
Findings: None
What changed in this PR
Adds username metadata to password-only pages so password managers can associate and autofill credentials without altering submitted form data.
Changes:
- Adds hidden, read-only username inputs before password fields.
- Covers identity-first and split username/password flows.
| File | Description |
|---|---|
themes/src/main/resources/theme/keycloak.v2/login/login.ftl |
Exposes the attempted username when the visible username field is hidden. |
themes/src/main/resources/theme/keycloak.v2/login/login-password.ftl |
Exposes the attempted username on password-only forms. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fbelliardtp
force-pushed
the
53207-password-page-username-hint
branch
from
September 28, 2026 06:36
890d9dd to
7456785
Compare
fbelliardtp
force-pushed
the
53207-password-page-username-hint
branch
from
October 5, 2026 14:41
7456785 to
7caf575
Compare
fbelliardtp
force-pushed
the
53207-password-page-username-hint
branch
from
October 5, 2026 15:59
7caf575 to
e3600dd
Compare
fbelliardtp
force-pushed
the
53207-password-page-username-hint
branch
from
October 26, 2026 07:43
e3600dd to
875f622
Compare
edewit
previously approved these changes
Oct 26, 2026
When the username was entered on a previous step, the password page only shows it in the read-only kc-attempted-username input, which sits outside the login form and has no autocomplete hint, so Chrome's password manager cannot match the saved credential. Add autocomplete="username" to that input and associate it with the login form via form="kc-form-login". The update password page has no username at all, so a password manager saves the new password without one. Add a hidden autocomplete="username" input using the username already passed by the UpdatePassword required action. Neither input has a name, so the submitted form data is unchanged. Closes keycloak#53207 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Florian BELLIARD <fbelliard@trustpair.com>
fbelliardtp
force-pushed
the
53207-password-page-username-hint
branch
from
November 18, 2026 07:38
875f622 to
2f9ae83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes in the
keycloak.v2login theme, so that browser password managers can associate the password with the right account when the username isn't on the page:kc-attempted-usernameinput fromtemplate.ftl, which sits outside the login<form>and has no autocomplete hint, so Chrome does not autofill the password. This addsautocomplete="username"to that input and associates it with the login form viaform="kc-form-login". On pages without akc-form-loginform the attribute does not resolve and has no effect.login-update-password.ftl): the page has no username at all, so a password manager saves the new password without one. This adds a hiddenautocomplete="username"input using theusernameattribute already passed by theUpdatePasswordrequired action. Suggested in Password-only login pages should expose the username to password managers #53207 (comment).Neither input has a
name, so the submitted form data is unchanged.Closes #53207
Testing
Manual, on 26.7.2 with the templates overridden in a custom theme, in Chrome with no saved credential for the site:
Firefox and 1Password already handled the password page fine.
autocomplete="username"alone onkc-attempted-usernamewas not enough for Chrome;form="kc-form-login"is needed as well. Submitted form data is unchanged and login and password update work as before.Automated: extended
OrganizationAuthenticationTest#testAuthenticateUnmanagedMember(assertsautocomplete/formonkc-attempted-username) andResetPasswordTest#resetPasswordEmailLinkWorksAfterNavigatingBackToLoginPage(asserts the hidden username input's value,autocomplete,hidden, noname). Both fail against main and pass with this change.Notes
Unrelated, pre-existing: the label of the
kc-attempted-usernamegroup is rendered as<label for="username">byfield.group, while the input's id iskc-attempted-username, which Chrome reports as an incorrectlabel for. Left out of this PR.AI assistance
This change was prepared with the help of an AI coding agent (Claude Code), including the investigation and the local testing. I reviewed the change and verified the behaviour in Chrome myself.