diff --git a/src/pkg/route.ts b/src/pkg/route.ts index 8fcdd30b..4eb0e169 100644 --- a/src/pkg/route.ts +++ b/src/pkg/route.ts @@ -20,6 +20,10 @@ export interface RouteOptions { faviconUrl?: string faviconType?: string theme?: Theme + extraPartials?: { + login: () => string + registration: () => string + } } export type RouteOptionsCreator = (req: Request, res: Response) => RouteOptions diff --git a/src/routes/login.ts b/src/routes/login.ts index d7e75cf9..b45bd8d1 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -30,7 +30,8 @@ export const createLoginRoute: RouteCreator = organization = "", login_challenge, } = req.query - const { frontend, kratosBrowserUrl, logoUrl } = createHelpers(req, res) + const { frontend, kratosBrowserUrl, logoUrl, extraPartials } = + createHelpers(req, res) const initFlowQuery = new URLSearchParams({ aal: aal.toString(), @@ -195,6 +196,8 @@ export const createLoginRoute: RouteCreator = }, { locale: res.locals.lang }, ), + extraPartial: extraPartials?.login, + extraContext: res.locals.extraContext, }) }) .catch(redirectOnSoftError(res, next, initFlowUrl)) diff --git a/src/routes/registration.ts b/src/routes/registration.ts index cd9f8cc8..37f74710 100644 --- a/src/routes/registration.ts +++ b/src/routes/registration.ts @@ -29,7 +29,8 @@ export const createRegistrationRoute: RouteCreator = login_challenge, organization, } = req.query - const { frontend, kratosBrowserUrl, logoUrl } = createHelpers(req, res) + const { frontend, kratosBrowserUrl, logoUrl, extraPartials } = + createHelpers(req, res) const initFlowQuery = new URLSearchParams({ ...(return_to && { return_to: return_to.toString() }), @@ -107,6 +108,8 @@ export const createRegistrationRoute: RouteCreator = }, { locale: res.locals.lang }, ), + extraPartial: extraPartials?.registration, + extraContext: res.locals.extraContext, }) }) .catch(redirectOnSoftError(res, next, initFlowUrl)) diff --git a/views/login.hbs b/views/login.hbs index c2d013a6..79c5b658 100644 --- a/views/login.hbs +++ b/views/login.hbs @@ -2,4 +2,7 @@ {{{card}}} {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_login_trigger"}} + {{#if extraPartial }} + {{> (extraPartial) }} + {{/if}} diff --git a/views/registration.hbs b/views/registration.hbs index 9dbdfe77..c1f32e68 100644 --- a/views/registration.hbs +++ b/views/registration.hbs @@ -3,4 +3,7 @@ {{{card}}} {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_register_trigger"}} + {{#if extraPartial }} + {{> (extraPartial) }} + {{/if}}