Enable to redirect back to the application from the account pages
This commit is contained in:
@ -26,7 +26,13 @@ export declare namespace KcContext {
|
|||||||
resourceUrl: string;
|
resourceUrl: string;
|
||||||
resourcesCommonPath: string;
|
resourcesCommonPath: string;
|
||||||
resourcesPath: string;
|
resourcesPath: string;
|
||||||
|
/** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */
|
||||||
referrerURI?: string;
|
referrerURI?: string;
|
||||||
|
// Present only if redirected to account page with ?referrer=xxx&referrer_uri=http...
|
||||||
|
referrer?: {
|
||||||
|
url: string; // The url of the App
|
||||||
|
name: string; // NOTE: Client id
|
||||||
|
};
|
||||||
getLogoutUrl: () => string;
|
getLogoutUrl: () => string;
|
||||||
};
|
};
|
||||||
features: {
|
features: {
|
||||||
|
@ -15,7 +15,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { url, realm, messagesPerField, stateChecker, account } = kcContext;
|
const { url, realm, messagesPerField, stateChecker, account, referrer } = kcContext;
|
||||||
|
|
||||||
const { msg } = i18n;
|
const { msg } = i18n;
|
||||||
|
|
||||||
@ -99,7 +99,9 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<div id="kc-form-buttons" className="col-md-offset-2 col-md-10 submit">
|
<div id="kc-form-buttons" className="col-md-offset-2 col-md-10 submit">
|
||||||
<div>
|
<div>
|
||||||
{url.referrerURI !== undefined && <a href={url.referrerURI}>{msg("backToApplication")}</a>}
|
{(referrer !== undefined || url.referrerURI !== undefined) && (
|
||||||
|
<a href={referrer?.url ?? url.referrerURI}>{msg("backToApplication")}</a>
|
||||||
|
)}
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className={clsx(
|
className={clsx(
|
||||||
|
Reference in New Issue
Block a user