Skip to content

Commit 0afcf82

Browse files
authored
fix: missing settings screen webauthn handler (#289)
1 parent f62260a commit 0afcf82

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/routes/settings.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ import {
1010
RouteCreator,
1111
RouteRegistrator,
1212
} from "../pkg"
13+
import { UiNodeInputAttributes } from "@ory/client"
1314
import { UserSettingsScreen } from "@ory/elements-markup"
15+
import {
16+
filterNodesByGroups,
17+
isUiNodeInputAttributes,
18+
} from "@ory/integrations/ui"
1419

1520
export const createSettingsRoute: RouteCreator =
1621
(createHelpers) => async (req, res, next) => {
@@ -67,6 +72,18 @@ export const createSettingsRoute: RouteCreator =
6772
nodes: flow.ui.nodes,
6873
nav: settingsScreen.Nav,
6974
settingsScreen: settingsScreen.Body,
75+
webAuthnHandler: filterNodesByGroups({
76+
nodes: flow.ui.nodes,
77+
groups: ["webauthn"],
78+
attributes: ["button"],
79+
withoutDefaultAttributes: true,
80+
withoutDefaultGroup: true,
81+
})
82+
.filter(({ attributes }) => isUiNodeInputAttributes(attributes))
83+
.map(({ attributes }) => {
84+
return (attributes as UiNodeInputAttributes).onclick
85+
})
86+
.filter((c) => c !== undefined),
7087
})
7188
})
7289
.catch(redirectOnSoftError(res, next, initFlowUrl))

views/partials/webauthn_setup.hbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
<script type="text/javascript">
1414
document.getElementsByName("{{webauthnTriggerName}}").forEach((v) => {
15-
console.log("attaching event listener")
1615
v.addEventListener("click", () => {
17-
console.log("clicked");
1816
{{{webAuthnHandler}}}
1917
})
2018
})

0 commit comments

Comments
 (0)