Skip to content

Commit

Permalink
fix endless loop on 2fa with no flow id
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Jan 9, 2024
1 parent 2e78275 commit 2e4acda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions KratosSelfService/Controllers/LoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public async Task<IActionResult> Login(
if (flowId == null)
{
logger.LogDebug("No flow ID found in URL query initializing login flow");
// workaround: if the user is in the 2fa flow, the user would get redirected infinitely,
// therefore log the user out first
foreach (var cookie in Request.Headers.Cookie)
{

Console.WriteLine(cookie);
}
if (Request.Headers.Cookie.Any(s => s.Contains("ory_kratos_session=")))
return Redirect("logout");
// initiate flow
return Redirect(GetInitFlowUrl(aal, refresh, returnTo, organization, loginChallenge));
}
Expand Down

0 comments on commit 2e4acda

Please sign in to comment.