From 050ec99c890b6427814c5bac5fac50acc005e3a8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 7 Oct 2021 18:29:28 +0200 Subject: [PATCH] flows: fix inspector history not being cleared when executing from API Signed-off-by: Jens Langhammer --- authentik/flows/api/flows.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 0e437193f..3f24679b7 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -32,7 +32,7 @@ from authentik.flows.planner import PLAN_CONTEXT_PENDING_USER, FlowPlanner, cach from authentik.flows.transfer.common import DataclassEncoder from authentik.flows.transfer.exporter import FlowExporter from authentik.flows.transfer.importer import FlowImporter -from authentik.flows.views.executor import SESSION_KEY_PLAN +from authentik.flows.views.executor import SESSION_KEY_HISTORY, SESSION_KEY_PLAN from authentik.lib.views import bad_request_message LOGGER = get_logger() @@ -334,6 +334,9 @@ class FlowViewSet(UsedByMixin, ModelViewSet): # pylint: disable=unused-argument def execute(self, request: Request, slug: str): """Execute flow for current user""" + # Because we pre-plan the flow here, and not in the planner, we need to manually clear + # the history of the inspector + request.session[SESSION_KEY_HISTORY] = [] flow: Flow = self.get_object() planner = FlowPlanner(flow) planner.use_cache = False