Skip to content

Format the recovery codes download timestamp in the user's locale - #52292

Open
dasniko wants to merge 1 commit into
keycloak:mainfrom
dasniko:pr/52291_navigator-language
Open

dasniko wants to merge 1 commit into
keycloak:mainfrom
dasniko:pr/52291_navigator-language

Conversation

@dasniko

@dasniko dasniko commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

New description/fix:
Use Keycloak's negotiated user language (from i18n context, locale attribute, ...) for formatting the the recovery codes download timestamp.

Was previously:
Trying to use the browsers preferred language first (it's the first entry in navigator.languages[], otherwise the default browser language from navigator.language. If nothing is available, use the hardcoded en-US locale.

Also removed old and unused code from a previous refactoring.

closes #52291

@dasniko
dasniko requested a review from a team as a code owner September 1, 2026 15:53
Copilot AI balanced review requested due to automatic review settings September 1, 2026 15:53
@dasniko
dasniko requested a review from a team as a code owner September 1, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Updates recovery code download date formatting to prefer the browser’s preferred locale, and removes leftover unused date-formatting code.

Changes:

  • Use navigator.languages[0] (fallback to navigator.language, then en-US) for Date#toLocaleString locale selection.
  • Remove unused dt/options variables from buildDownloadContent() after refactoring.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl Switches date formatting locale to browser-preferred language and removes unused date formatting variables.
themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl Same locale-selection update for date formatting and cleanup of unused variables.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 1, 2026 16:45
@dasniko
dasniko force-pushed the pr/52291_navigator-language branch from 595ceaa to 3d66b18 Compare September 1, 2026 16:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@dasniko

dasniko commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor Author

After investigating on how to resolve the proper browser locale (results in too much code, related to the issue we actually fix), decided to change from browser locale to Keycloak's negotiated locale, which is available as lang attribute in FreeMarker context.

Copilot AI review requested due to automatic review settings September 1, 2026 19:39
@dasniko
dasniko force-pushed the pr/52291_navigator-language branch from 3d66b18 to c8d32d2 Compare September 1, 2026 19:39
@dasniko dasniko changed the title Prefer locale usage for date formatting by using browser-preferred language Format the recovery codes download timestamp in the user's locale Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@dasniko

dasniko commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Don't know why the DCO check is invalid. The sign-off line looks good to me. What's actually wrong with it?

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest#crudWithFailover

Keycloak CI - Clustering IT

jakarta.ws.rs.WebApplicationException: Create method returned status Forbidden (Code: 403); expected status: Created (201). Response body: {"error":"HTTP 403 Forbidden"}
	at org.keycloak.testsuite.admin.ApiUtil.getCreatedId(ApiUtil.java:38)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createClient(PermissionTicketInvalidationClusterTest.java:61)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createTestRealm(PermissionTicketInvalidationClusterTest.java:46)
	at org.keycloak.testsuite.cluster.AbstractInvalidationClusterTestWithTestRealm.createTestRealm(AbstractInvalidationClusterTestWithTestRealm.java:18)
...

Report flaky test

1 similar comment
@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest#crudWithFailover

Keycloak CI - Clustering IT

jakarta.ws.rs.WebApplicationException: Create method returned status Forbidden (Code: 403); expected status: Created (201). Response body: {"error":"HTTP 403 Forbidden"}
	at org.keycloak.testsuite.admin.ApiUtil.getCreatedId(ApiUtil.java:38)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createClient(PermissionTicketInvalidationClusterTest.java:61)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createTestRealm(PermissionTicketInvalidationClusterTest.java:46)
	at org.keycloak.testsuite.cluster.AbstractInvalidationClusterTestWithTestRealm.createTestRealm(AbstractInvalidationClusterTestWithTestRealm.java:18)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

edewit
edewit previously approved these changes Sep 2, 2026
@edewit

edewit commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

DCO failed because: Commit sha: c8d32d2, Author: Niko Köbler, Committer: Niko Köbler; Expected "Niko Köbler niko@n-k.de", but got "Niko Köbler niko@n-k.de".

IDK but that looks like the same thing

@edewit
edewit enabled auto-merge (squash) September 2, 2026 11:21

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest#crudWithFailover

Keycloak CI - Clustering IT

jakarta.ws.rs.WebApplicationException: Create method returned status Forbidden (Code: 403); expected status: Created (201). Response body: {"error":"HTTP 403 Forbidden"}
	at org.keycloak.testsuite.admin.ApiUtil.getCreatedId(ApiUtil.java:38)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createClient(PermissionTicketInvalidationClusterTest.java:61)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createTestRealm(PermissionTicketInvalidationClusterTest.java:46)
	at org.keycloak.testsuite.cluster.AbstractInvalidationClusterTestWithTestRealm.createTestRealm(AbstractInvalidationClusterTestWithTestRealm.java:18)
...

Report flaky test

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest#crudWithFailover

Keycloak CI - Clustering IT

jakarta.ws.rs.WebApplicationException: Create method returned status Forbidden (Code: 403); expected status: Created (201). Response body: {"error":"HTTP 403 Forbidden"}
	at org.keycloak.testsuite.admin.ApiUtil.getCreatedId(ApiUtil.java:38)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createClient(PermissionTicketInvalidationClusterTest.java:61)
	at org.keycloak.testsuite.cluster.PermissionTicketInvalidationClusterTest.createTestRealm(PermissionTicketInvalidationClusterTest.java:46)
	at org.keycloak.testsuite.cluster.AbstractInvalidationClusterTestWithTestRealm.createTestRealm(AbstractInvalidationClusterTestWithTestRealm.java:18)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@dasniko

dasniko commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

What does it take to merge this (very small) fix?

@ahus1 ahus1 self-assigned this Nov 23, 2026
Also removed old and unused code from a previous refactoring.

closes keycloak#52291

Signed-off-by: Niko Köbler <niko@n-k.de>
auto-merge was automatically disabled November 23, 2026 18:42

Head branch was pushed to by a user without write access

@dasniko
dasniko force-pushed the pr/52291_navigator-language branch from c8d32d2 to b612442 Compare November 23, 2026 18:42
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format the download timestamp of recovery codes in users locale

5 participants