Update Keycloakify

This commit is contained in:
Joseph Garrone 2024-04-10 03:43:23 +02:00
parent 3dcca4203e
commit 32f1de064b
4 changed files with 12 additions and 12 deletions

View file

@ -20,7 +20,7 @@
"keywords": [], "keywords": [],
"dependencies": { "dependencies": {
"evt": "^2.5.7", "evt": "^2.5.7",
"keycloakify": "^9.6.4", "keycloakify": "^9.6.6",
"oidc-spa": "^4.2.1", "oidc-spa": "^4.2.1",
"powerhooks": "^1.0.8", "powerhooks": "^1.0.8",
"react": "^18.2.0", "react": "^18.2.0",

View file

@ -25,7 +25,9 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
`${url.resourcesPath}/css/account.css` `${url.resourcesPath}/css/account.css`
], ],
"htmlClassName": getClassName("kcHtmlClass"), "htmlClassName": getClassName("kcHtmlClass"),
"bodyClassName": clsx("admin-console", "user", getClassName("kcBodyClass")) "bodyClassName": clsx("admin-console", "user", getClassName("kcBodyClass")),
"htmlLangProperty": locale?.currentLanguageTag,
"documentTitle": i18n.msgStr("accountManagementTitle")
}); });
if (!isReady) { if (!isReady) {
@ -47,14 +49,12 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
{realm.internationalizationEnabled && (assert(locale !== undefined), true) && locale.supported.length > 1 && ( {realm.internationalizationEnabled && (assert(locale !== undefined), true) && locale.supported.length > 1 && (
<li> <li>
<div className="kc-dropdown" id="kc-locale-dropdown"> <div className="kc-dropdown" id="kc-locale-dropdown">
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a href="#" id="kc-current-locale-link"> <a href="#" id="kc-current-locale-link">
{labelBySupportedLanguageTag[currentLanguageTag]} {labelBySupportedLanguageTag[currentLanguageTag]}
</a> </a>
<ul> <ul>
{locale.supported.map(({ languageTag }) => ( {locale.supported.map(({ languageTag }) => (
<li key={languageTag} className="kc-dropdown-item"> <li key={languageTag} className="kc-dropdown-item">
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a href="#" onClick={() => changeLocale(languageTag)}> <a href="#" onClick={() => changeLocale(languageTag)}>
{labelBySupportedLanguageTag[languageTag]} {labelBySupportedLanguageTag[languageTag]}
</a> </a>

View file

@ -1,6 +1,6 @@
// Copy pasted from: https://github.com/InseeFrLab/keycloakify/blob/main/src/login/Template.tsx // Copy pasted from: https://github.com/InseeFrLab/keycloakify/blob/main/src/login/Template.tsx
import { useState, useEffect } from "react"; import { useEffect } from "react";
import { assert } from "keycloakify/tools/assert"; import { assert } from "keycloakify/tools/assert";
import { clsx } from "keycloakify/tools/clsx"; import { clsx } from "keycloakify/tools/clsx";
import { usePrepareTemplate } from "keycloakify/lib/usePrepareTemplate"; import { usePrepareTemplate } from "keycloakify/lib/usePrepareTemplate";
@ -42,11 +42,11 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
`${url.resourcesPath}/css/login.css` `${url.resourcesPath}/css/login.css`
], ],
"htmlClassName": getClassName("kcHtmlClass"), "htmlClassName": getClassName("kcHtmlClass"),
"bodyClassName": getClassName("kcBodyClass") "bodyClassName": getClassName("kcBodyClass"),
"htmlLangProperty": locale?.currentLanguageTag,
"documentTitle": i18n.msgStr("loginTitle", kcContext.realm.displayName)
}); });
useState(()=> { document.title = i18n.msgStr("loginTitle", kcContext.realm.displayName); });
useEffect(() => { useEffect(() => {
console.log(`Value of MY_ENV_VARIABLE on the Keycloak server: "${kcContext.properties.MY_ENV_VARIABLE}"`); console.log(`Value of MY_ENV_VARIABLE on the Keycloak server: "${kcContext.properties.MY_ENV_VARIABLE}"`);
}, []); }, []);

View file

@ -5407,10 +5407,10 @@ jwt-decode@^3.1.2:
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
keycloakify@^9.6.4: keycloakify@^9.6.6:
version "9.6.4" version "9.6.6"
resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-9.6.4.tgz#5df6a960d084cd52b1501ba9e4ab46adf31fd41e" resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-9.6.6.tgz#ecad120acf72d8b3d7faded9ddff9ee23b4f3139"
integrity sha512-KIOr8GG624dfwlaOxkooTgq5pJgH94qXz3ee1sY38wsqE13BkxI1/SM7mLk/eKiaaTPGW0VANTk3PgJuWv5HGg== integrity sha512-G59FKXp1zbY1k5o5V2ldHl+SOcOOSt59hKsz2wS/RJEMENO8th4vPmLIP7L0rJyJaFfiFR9X/igaCMODKqpbQQ==
dependencies: dependencies:
"@babel/generator" "^7.22.9" "@babel/generator" "^7.22.9"
"@babel/parser" "^7.22.7" "@babel/parser" "^7.22.7"