From 85e86351cdb1becd6070095a49933145db6e540e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 1 Aug 2021 17:50:43 +0200 Subject: [PATCH] flows: fix flows not redirecting correctly Signed-off-by: Jens Langhammer --- authentik/flows/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/authentik/flows/views.py b/authentik/flows/views.py index 3f3fe4b09..ddfb8fa44 100644 --- a/authentik/flows/views.py +++ b/authentik/flows/views.py @@ -322,15 +322,16 @@ class FlowExecutorView(APIView): """User Successfully passed all stages""" # Since this is wrapped by the ExecutorShell, the next argument is saved in the session # extract the next param before cancel as that cleans it - self.cancel() if self.plan and PLAN_CONTEXT_REDIRECT in self.plan.context: # The context `redirect` variable can only be set by # an expression policy or authentik itself, so we don't # check if its an absolute URL or a relative one + self.cancel() return redirect(self.plan.context.get(PLAN_CONTEXT_REDIRECT)) next_param = self.request.session.get(SESSION_KEY_GET, {}).get( NEXT_ARG_NAME, "authentik_core:root-redirect" ) + self.cancel() return to_stage_response(self.request, redirect_with_qs(next_param)) def stage_ok(self) -> HttpResponse: