flows: stage_invalid() makes flow restart depending on invalid_response_action setting (#6780)
* flows: stage_invalid() makes flow restart depending on invalid_response_action setting Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
82cbc16c45
commit
b15002a992
|
@ -42,6 +42,7 @@ from authentik.flows.models import (
|
||||||
FlowDesignation,
|
FlowDesignation,
|
||||||
FlowStageBinding,
|
FlowStageBinding,
|
||||||
FlowToken,
|
FlowToken,
|
||||||
|
InvalidResponseAction,
|
||||||
Stage,
|
Stage,
|
||||||
)
|
)
|
||||||
from authentik.flows.planner import (
|
from authentik.flows.planner import (
|
||||||
|
@ -105,7 +106,7 @@ class FlowExecutorView(APIView):
|
||||||
flow: Flow
|
flow: Flow
|
||||||
|
|
||||||
plan: Optional[FlowPlan] = None
|
plan: Optional[FlowPlan] = None
|
||||||
current_binding: FlowStageBinding
|
current_binding: Optional[FlowStageBinding] = None
|
||||||
current_stage: Stage
|
current_stage: Stage
|
||||||
current_stage_view: View
|
current_stage_view: View
|
||||||
|
|
||||||
|
@ -411,6 +412,19 @@ class FlowExecutorView(APIView):
|
||||||
Optionally, an exception can be passed, which will be shown if the current user
|
Optionally, an exception can be passed, which will be shown if the current user
|
||||||
is a superuser."""
|
is a superuser."""
|
||||||
self._logger.debug("f(exec): Stage invalid")
|
self._logger.debug("f(exec): Stage invalid")
|
||||||
|
if self.current_binding and self.current_binding.invalid_response_action in [
|
||||||
|
InvalidResponseAction.RESTART,
|
||||||
|
InvalidResponseAction.RESTART_WITH_CONTEXT,
|
||||||
|
]:
|
||||||
|
keep_context = (
|
||||||
|
self.current_binding.invalid_response_action
|
||||||
|
== InvalidResponseAction.RESTART_WITH_CONTEXT
|
||||||
|
)
|
||||||
|
self._logger.debug(
|
||||||
|
"f(exec): Invalid response, restarting flow",
|
||||||
|
keep_context=keep_context,
|
||||||
|
)
|
||||||
|
return self.restart_flow(keep_context)
|
||||||
self.cancel()
|
self.cancel()
|
||||||
challenge_view = AccessDeniedChallengeView(self, error_message)
|
challenge_view = AccessDeniedChallengeView(self, error_message)
|
||||||
challenge_view.request = self.request
|
challenge_view.request = self.request
|
||||||
|
|
Reference in New Issue