flows: fix denied view not being registered
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
"""flow urls"""
|
||||
from django.urls import path
|
||||
|
||||
from passbook.flows.views import FlowExecutorView
|
||||
from passbook.flows.views import FlowExecutorView, FlowPermissionDeniedView
|
||||
|
||||
urlpatterns = [
|
||||
path("<slug:flow_slug>/", FlowExecutorView.as_view(), name="flow-executor"),
|
||||
path("denied/", FlowPermissionDeniedView.as_view(), name="denied"),
|
||||
]
|
||||
|
||||
@ -8,6 +8,7 @@ from django.views.generic import View
|
||||
from structlog import get_logger
|
||||
|
||||
from passbook.core.models import Factor
|
||||
from passbook.core.views.utils import PermissionDeniedView
|
||||
from passbook.flows.exceptions import FlowNonApplicableError
|
||||
from passbook.flows.models import Flow
|
||||
from passbook.flows.planner import PLAN_CONTEXT_PENDING_USER, FlowPlan, FlowPlanner
|
||||
@ -144,9 +145,13 @@ class FlowExecutorView(View):
|
||||
or the user account is disabled."""
|
||||
LOGGER.debug("User invalid")
|
||||
self.cancel()
|
||||
return redirect_with_qs("passbook_flows:auth-denied", self.request.GET)
|
||||
return redirect_with_qs("passbook_flows:denied", self.request.GET)
|
||||
|
||||
def cancel(self) -> HttpResponse:
|
||||
"""Cancel current execution and return a redirect"""
|
||||
del self.request.session[SESSION_KEY_PLAN]
|
||||
return redirect_with_qs("passbook_flows:auth-denied", self.request.GET)
|
||||
return redirect_with_qs("passbook_flows:denied", self.request.GET)
|
||||
|
||||
|
||||
class FlowPermissionDeniedView(PermissionDeniedView):
|
||||
"""User could not be authenticated"""
|
||||
|
||||
Reference in New Issue
Block a user