Skip to content

Commit 2cb52af

Browse files
authored
fix: login should respect return_to on navigation to recovery (#244)
* fix: login should carry over return_to to recovery flow * fix: login return_to should be used by recovery url
1 parent 2faf192 commit 2cb52af

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/routes/login.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ export const createLoginRoute: RouteCreator =
8383
initRegistrationQuery,
8484
)
8585

86+
const initRecoveryUrl = getUrlForFlow(
87+
kratosBrowserUrl,
88+
"recovery",
89+
new URLSearchParams({
90+
return_to:
91+
(return_to && return_to.toString()) || flow.return_to || "",
92+
}),
93+
)
94+
8695
res.render("login", {
8796
nodes: flow.ui.nodes,
8897
webAuthnHandler: filterNodesByGroups({
@@ -111,7 +120,7 @@ export const createLoginRoute: RouteCreator =
111120
flowType: "login",
112121
cardImage: logoUrl,
113122
additionalProps: {
114-
forgotPasswordURL: "recovery",
123+
forgotPasswordURL: initRecoveryUrl,
115124
signupURL: initRegistrationUrl,
116125
logoutURL: logoutUrl,
117126
},

0 commit comments

Comments
 (0)