Skip to content

✨ Close the login/register template feature gap in Keycloak theme - #2930

Closed
xalsina-sequent wants to merge 1 commit into
release/10.0from
feat/meta-12713/release/10.0
Closed

✨ Close the login/register template feature gap in Keycloak theme#2930
xalsina-sequent wants to merge 1 commit into
release/10.0from
feat/meta-12713/release/10.0

Conversation

@xalsina-sequent

Copy link
Copy Markdown
Contributor

Summary

  • MultiAttributePasswordAuthenticator's login.ftl fields now render through the same User Profile-driven macros register.ftl uses (a new LoginBean, mirroring Keycloak's own RegisterBean, exposes profile.attributesByName), instead of a bespoke {name,type} field list - closing the gap where login.ftl didn't show field-specific input types, helper text, select filtering, or the shared tel-input widget.
  • Extracted the duplication this surfaced into shared macros under sequent.admin-portal/login/: field-helper-text.ftl, tel-input-widget.ftl, select-filter-widget.ftl, social-providers.ftl - now used by register.ftl and both sequent.admin-portal/sequent.voting-portallogin.ftl copies.
  • Removed a dead mobile-attribute special case in register.ftl (no realm ever configures a User Profile attribute literally named mobile).
  • Added an opt-in honorUserProfileRequired config property on MultiAttributePasswordAuthenticator: when enabled, a matchAttributes field's required-ness (asterisk, HTML5 required, and whether it's optional for matching) follows the realm's User Profile required setting for that attribute, instead of every configured attribute being unconditionally mandatory. Disabled by default - no behavior change for existing realms.
  • The optional-attribute filtering (effectiveMatchAttributes) lives entirely in the authenticator, so MultiAttributeCredentialResolver - shared with the IVR direct grant flow - is untouched.

Test plan

  • mvn -pl sequent-theme,message-otp-authenticator clean test - 134 tests passing (including new coverage for honorUserProfileRequired's required/optional matching and rendering, and the shared macros)
  • mvn -pl sequent-theme,message-otp-authenticator spotless:check - clean
  • Manual: verify login.ftl renders correctly for both portals with a realm configuring matchAttributes (date/select/tel field types, helper text)
  • Manual: enable honorUserProfileRequired on a test realm and confirm optional attributes can be left blank while still matching

Parent issue: https://github.com/sequentech/meta/issues/12713

🤖 Generated with Claude Code

Shares User Profile-driven rendering between register.ftl and both portals'
login.ftl instead of MultiAttributePasswordAuthenticator building its own
{name,type} field list: a new LoginBean (mirroring Keycloak's RegisterBean)
exposes profile.attributesByName to login.ftl, which now renders matchAttributes
fields through the same user-profile-commons.ftl macros register.ftl uses -
picking up field types, helper text, select filtering and tel-input handling
for free.
Extracts the duplication this surfaced into shared macros in
sequent.admin-portal/login/: field-helper-text.ftl, tel-input-widget.ftl,
select-filter-widget.ftl and social-providers.ftl (now used by register.ftl
and both login.ftl copies). Removes a dead "mobile" special case in
register.ftl (no realm ever configured that attribute).
Adds an opt-in honorUserProfileRequired config to MultiAttributePasswordAuthenticator:
when enabled, a matchAttributes field's required-ness (asterisk, HTML5
required, and whether it's optional for matching) follows the realm's User
Profile required setting for that attribute instead of every configured
attribute being unconditionally mandatory. The optional-attribute filtering
lives entirely in the authenticator (effectiveMatchAttributes), keeping
MultiAttributeCredentialResolver - shared with the IVR direct grant flow -
unchanged.
Parent issue: sequentech/meta#12713
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9229c9e4-f189-4212-b442-69f9db386873

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@xalsina-sequent
xalsina-sequent marked this pull request as draft August 20, 2026 15:09
Findeton added a commit that referenced this pull request Aug 23, 2026
Parent issue: sequentech/meta#12713
`main` counterpart of #2930 (`release/10.0`), cherry-picked from
`abbfa30bc7`.
`register.ftl` and `login.ftl` (both `sequent.admin-portal` and
`sequent.voting-portal` themes) had drifted apart:
`MultiAttributePasswordAuthenticator`'s `login.ftl` rendered its
`matchAttributes` fields from a bespoke `{name,type}` list built in
Java, so it was missing field-specific input types, User Profile helper
text, select filtering, and the shared tel-input widget that
`register.ftl` already had - plus every configured attribute was
unconditionally mandatory to match, with no way to make some optional.
## Changes
- Added `LoginBean` (mirrors Keycloak's own `RegisterBean`), exposing
`profile.attributesByName` to `login.ftl` so its `matchAttributes` loop
renders through the same `user-profile-commons.ftl` macros
`register.ftl` uses - same field types, helper text, select filtering,
tel-input handling.
- Extracted the duplication this surfaced into shared macros under
`sequent.admin-portal/login/`: `field-helper-text.ftl`,
`tel-input-widget.ftl`, `select-filter-widget.ftl`,
`social-providers.ftl` - now shared by `register.ftl` and both portals'
`login.ftl`.
- Removed a dead `mobile`-attribute special case in `register.ftl` (no
realm ever configures a User Profile attribute literally named
`mobile`).
- Added an opt-in `honorUserProfileRequired` config property on
`MultiAttributePasswordAuthenticator`: when enabled, a `matchAttributes`
field's required-ness (asterisk, HTML5 `required`, and whether it's
optional for matching) follows the realm's User Profile `required`
setting for that attribute, instead of every configured attribute being
unconditionally mandatory. Disabled by default, so existing realms are
unaffected. The optional-attribute filtering lives entirely in the
authenticator (`effectiveMatchAttributes`), so
`MultiAttributeCredentialResolver` - shared with the IVR direct grant
flow - is unchanged.
## Documentation
Not in #2930 - added here:
- New reference page **Configuring Login and Registration Fields**
documenting how User Profile attributes and their annotations drive both
the registration form and the attribute-based login form (input types,
labels/translations, helper text, field limits, option lists and
dependent dropdowns, phone-number fields, required-ness, hiding,
login-hint prefilling).
- Cross-linked from *Adding User Attributes to Keycloak* and *Logging In
Without a Username*, and documented the new **Honor User Profile
required attributes** setting in the latter's config steps.
## Conflict resolution vs #2930
`main` has moved on since `abbfa30bc7`. Resolved while cherry-picking:
- `buildAttributeFields` (and its `inputTypeMax` → `max` forwarding,
added on `main` by #3000) is deleted, as in #2930 - the `max` attribute
and its `9999-12-31` default now come from `user-profile-commons.ftl`'s
shared `inputTag` macro, which both forms go through.
- Kept
`TemplateSyntaxTest#multiAttributeDateInputsHonorConfiguredMaxInBothPortals`
from #3000, rewritten against the new `profile.attributesByName` model
so the four-digit-year regression stays covered on both portals. Its
`renderLogin(portal, model)` helper is kept alongside #2930's new
`profileWithAttributes` / `mockAttribute` helpers.
- Dropped the four `buildAttributeFields_*` unit tests, whose subject no
longer exists; the behaviour they covered is now asserted at the
template level.
## Testing
`mvn -pl sequent-theme test` - 28 tests pass.
`message-otp-authenticator` tests were not run locally (its
`action-token-login-bridge` dependency fails to build under JDK 21; this
reproduces on a clean `main` and is unrelated to this change) - CI
covers them on JDK 17.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Login and registration forms support configurable credential
placement, validation modes, field types, labels, helper text,
dropdowns, date inputs, and localized phone widgets.
- Multi-attribute login can optionally follow profile-defined required
fields.
- Social sign-in providers display consistently, with policy-based
digital certificate visibility.
- Phone fields provide improved formatting and timezone-based country
detection.
- **Bug Fixes**
- Improved focus behavior, autocomplete, accessibility, required-field
handling, annotation support, fallback fields, and form layout.
- **Documentation**
- Expanded guidance for profile fields, annotations, requiredness,
multi-attribute login, and certificate-login provider visibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Félix Robles <felix@sequentech.io>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@xalsina-sequent