Commit 40eb2393 authored by ViolanteCodes's avatar ViolanteCodes
Browse files

updated custom 403 handler to take a variable "response message" to make it...

updated custom 403 handler to take a  variable "response message" to make it easier to change/update later
parent 41a257fc
......@@ -15,8 +15,22 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from ratelimit.exceptions import Ratelimited
from django.http import HttpResponse
from django.shortcuts import redirect
def handler403(request, exception=None):
"""Custom 403 handler for ratelimit exceptions."""
response_message = """This ticket has failed due to too many requests in
a short period of time. If you like, you can hit the "back" button to return
to your form. Your data should still be filled in. You can then
wait and retry creating your ticket."""
if isinstance(exception, Ratelimited):
return HttpResponse(response_message, status=403)
return HttpResponseForbidden('Forbidden')
urlpatterns = [
path('tor_admin/', admin.site.urls),
path('', include('anonticket.urls'))
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment