diff --git a/passbook/core/urls.py b/passbook/core/urls.py index 3e3ce066f..083a142d3 100644 --- a/passbook/core/urls.py +++ b/passbook/core/urls.py @@ -19,10 +19,10 @@ urlpatterns = [ name="auth-password-reset", ), # User views - path("_/user/", user.UserSettingsView.as_view(), name="user-settings"), - path("_/user/delete/", user.UserDeleteView.as_view(), name="user-delete"), + path("-/user/", user.UserSettingsView.as_view(), name="user-settings"), + path("-/user/delete/", user.UserDeleteView.as_view(), name="user-delete"), path( - "_/user/change_password/", + "-/user/change_password/", user.UserChangePasswordView.as_view(), name="user-change-password", ), diff --git a/passbook/flows/urls.py b/passbook/flows/urls.py index 060911c27..9198aab18 100644 --- a/passbook/flows/urls.py +++ b/passbook/flows/urls.py @@ -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("/", FlowExecutorView.as_view(), name="flow-executor"), + path("denied/", FlowPermissionDeniedView.as_view(), name="denied"), ] diff --git a/passbook/flows/views.py b/passbook/flows/views.py index fed6e673f..e10f07adb 100644 --- a/passbook/flows/views.py +++ b/passbook/flows/views.py @@ -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""" diff --git a/passbook/root/urls.py b/passbook/root/urls.py index b7e44d7cd..8f3d09b83 100644 --- a/passbook/root/urls.py +++ b/passbook/root/urls.py @@ -45,4 +45,4 @@ urlpatterns += [ if settings.DEBUG: import debug_toolbar - urlpatterns = [path("__debug__/", include(debug_toolbar.urls)),] + urlpatterns + urlpatterns = [path("-/debug/", include(debug_toolbar.urls)),] + urlpatterns