Skip to content

Commit

Permalink
404 when access isn't permitted
Browse files Browse the repository at this point in the history
  • Loading branch information
nmenezes0 committed Aug 12, 2024
1 parent a6fa813 commit 73ef140
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions consultation_analyser/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.http import HttpResponseRedirect
from django.http import HttpResponseNotFound


class SupportAppStaffRequiredMiddleware:
Expand All @@ -11,7 +11,7 @@ def __call__(self, request):
response = self.get_response(request)
if request.path.startswith("/support/"):
if not request.user.is_authenticated:
return HttpResponseRedirect("/")
return HttpResponseNotFound()
elif not request.user.is_staff:
return HttpResponseRedirect("/")
return HttpResponseNotFound()
return response

0 comments on commit 73ef140

Please sign in to comment.