diff --git a/js/apps/account-ui/pom.xml b/js/apps/account-ui/pom.xml index 0ff1774c9f..1da7f4576b 100644 --- a/js/apps/account-ui/pom.xml +++ b/js/apps/account-ui/pom.xml @@ -1,5 +1,7 @@ - + 4.0.0 @@ -71,6 +73,14 @@ href="./ href="${resourceUrl}/ + + ]]> + ]]> + + + Keycloak account console]]> + ${properties.title!"Keycloak account console"}]]> + ]]> @@ -80,7 +90,9 @@ "authUrl": "${authUrl}", "isRunningAsTheme": true, "realm": "${realm.name}", - "resourceUrl": "${resourceUrl}" + "resourceUrl": "${resourceUrl}", + "logo": "${properties.logo!""}", + "logoUrl": "${properties.logoUrl!""}" } @@ -97,7 +109,7 @@ -]]> +]]> @@ -105,4 +117,4 @@ - + \ No newline at end of file diff --git a/js/apps/account-ui/src/environment.ts b/js/apps/account-ui/src/environment.ts index fd1faede83..16807915d3 100644 --- a/js/apps/account-ui/src/environment.ts +++ b/js/apps/account-ui/src/environment.ts @@ -7,6 +7,10 @@ export type Environment = { realm: string; /** The URL to resources such as the files in the `public` directory. */ resourceUrl: string; + /** Indicates the src for the Brand image */ + logo: string; + /** Indicates the url to be followed when Brand image is clicked */ + logoUrl: string; }; // The default environment, used during development. @@ -15,6 +19,8 @@ const defaultEnvironment: Environment = { isRunningAsTheme: false, realm: "master", resourceUrl: "http://localhost:8080", + logo: "/logo.svg", + logoUrl: "/", }; // Merge the default and injected environment variables together. diff --git a/js/apps/account-ui/src/root/Root.tsx b/js/apps/account-ui/src/root/Root.tsx index 0d0de15a49..ad1200135d 100644 --- a/js/apps/account-ui/src/root/Root.tsx +++ b/js/apps/account-ui/src/root/Root.tsx @@ -37,7 +37,12 @@ const ReferrerLink = () => { export const Root = () => { const { t } = useTranslation(); - const indexHref = useHref("/"); + const brandImage = environment.logo || "logo.svg"; + const logoUrl = environment.logoUrl ? environment.logoUrl : "/"; + const internalLogoHref = useHref(logoUrl); + + // User can indicate that he wants an internal URL by starting it with "/" + const indexHref = logoUrl.startsWith("/") ? internalLogoHref : logoUrl; const translations = useMemo( () => ({ @@ -59,7 +64,7 @@ export const Root = () => { showNavToggle brand={{ href: indexHref, - src: joinPath(environment.resourceUrl, "logo.svg"), + src: joinPath(environment.resourceUrl, brandImage), alt: t("logo"), className: style.brand, }}