diff --git a/src/routes/login.ts b/src/routes/login.ts index 7f94a216..2d470f78 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -173,18 +173,6 @@ export const createLoginRoute: RouteCreator = res.render("login", { nodes: flow.ui.nodes, - webAuthnHandler: filterNodesByGroups({ - nodes: flow.ui.nodes, - groups: ["webauthn", "passkey"], - attributes: ["button"], - withoutDefaultAttributes: true, - withoutDefaultGroup: true, - }) - .filter(({ attributes }) => isUiNodeInputAttributes(attributes)) - .map(({ attributes }) => { - return (attributes as UiNodeInputAttributes).onclick - }) - .filter((c) => c !== undefined), card: UserAuthCard( { flow, diff --git a/src/routes/registration.ts b/src/routes/registration.ts index 5388121c..a23316d6 100644 --- a/src/routes/registration.ts +++ b/src/routes/registration.ts @@ -79,21 +79,9 @@ export const createRegistrationRoute: RouteCreator = flow.oauth2_login_request.challenge, ) } - const webAuthnHandler = filterNodesByGroups({ - nodes: flow.ui.nodes, - groups: ["webauthn", "passkey"], - attributes: ["button"], - withoutDefaultAttributes: true, - withoutDefaultGroup: true, - }) - .filter(({ attributes }) => isUiNodeInputAttributes(attributes)) - .map(({ attributes }) => { - return (attributes as UiNodeInputAttributes).onclick - }) - .filter((onClickAction) => !!onClickAction) + res.render("registration", { nodes: flow.ui.nodes, - webAuthnHandler: webAuthnHandler, card: UserAuthCard( { flow, diff --git a/src/routes/settings.ts b/src/routes/settings.ts index 01fe982a..71aafe5c 100644 --- a/src/routes/settings.ts +++ b/src/routes/settings.ts @@ -77,18 +77,6 @@ export const createSettingsRoute: RouteCreator = nodes: flow.ui.nodes, nav: settingsScreen.Nav, settingsScreen: settingsScreen.Body, - webAuthnHandler: filterNodesByGroups({ - nodes: flow.ui.nodes, - groups: ["webauthn", "passkey"], - attributes: ["button"], - withoutDefaultAttributes: true, - withoutDefaultGroup: true, - }) - .filter(({ attributes }) => isUiNodeInputAttributes(attributes)) - .map(({ attributes }) => { - return (attributes as UiNodeInputAttributes).onclick - }) - .filter((c) => c !== undefined), }) }) .catch(redirectOnSoftError(res, next, initFlowUrl)) diff --git a/views/login.hbs b/views/login.hbs index e0a962b9..befffb2f 100644 --- a/views/login.hbs +++ b/views/login.hbs @@ -1,7 +1,6 @@
{{{card}}} - {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_login_trigger"}} {{> js_setup nodes=nodes}} {{#if extraPartial }} {{> (extraPartial) }} diff --git a/views/partials/js_setup.hbs b/views/partials/js_setup.hbs index de9decd0..0e08b766 100644 --- a/views/partials/js_setup.hbs +++ b/views/partials/js_setup.hbs @@ -1,8 +1,20 @@ +{{! This inserts the webauthn.js script tag}} +{{#each (onlyNodes nodes "webauthn" "text/javascript")}} + +{{/each}} {{! This partial sets up the onclick and onload event handlers for each passkey node.}} -{{/each}} - - diff --git a/views/registration.hbs b/views/registration.hbs index 38c438f2..ba3b8a2b 100644 --- a/views/registration.hbs +++ b/views/registration.hbs @@ -2,7 +2,6 @@ {{{card}}} - {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_register_trigger"}} {{> js_setup nodes=nodes}} {{#if extraPartial }} {{> (extraPartial) }} diff --git a/views/settings.hbs b/views/settings.hbs index 547d044e..c6a2f6ee 100644 --- a/views/settings.hbs +++ b/views/settings.hbs @@ -4,6 +4,5 @@ {{{settingsScreen}}}
- {{> webauthn_setup nodes=nodes webAuthnHandler=webAuthnHandler webauthnTriggerName="webauthn_register_trigger"}} {{> js_setup nodes=nodes}}