Skip to content

Commit 3404572

Browse files
authored
Fix finish of account recovery flow deleted web session #3527
ref #3502 (comment)
2 parents 347bd23 + 51db67c commit 3404572

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/auth/handler/webapp/authflow_controller.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,20 +562,21 @@ func (c *AuthflowController) AdvanceWithInput(
562562
result.NavigationAction = "redirect"
563563
result.RedirectURI = c.deriveFinishRedirectURI(r, s, &flowResponse2)
564564

565-
err = c.Sessions.Delete(s.ID)
566-
if err != nil {
567-
return
568-
}
569-
570565
switch flowResponse2.Type {
571566
case authflow.FlowTypeLogin:
572567
fallthrough
573568
case authflow.FlowTypePromote:
574569
fallthrough
575570
case authflow.FlowTypeSignup:
576571
fallthrough
572+
case authflow.FlowTypeSignupLogin:
573+
fallthrough
577574
case authflow.FlowTypeReauth:
578575
// Forget the session.
576+
err = c.Sessions.Delete(s.ID)
577+
if err != nil {
578+
return
579+
}
579580
result.Cookies = append(result.Cookies, c.Cookies.ClearCookie(c.SessionCookie.Def))
580581
// Reset visitor ID.
581582
result.Cookies = append(result.Cookies, c.Cookies.ClearCookie(webapp.VisitorIDCookieDef))

0 commit comments

Comments
 (0)