Skip to content

Commit 6b15f0b

Browse files
committed
Use consistent template for 403/404 error page
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 4634ce2 commit 6b15f0b

4 files changed

Lines changed: 5 additions & 16 deletions

File tree

fedcode/templates/403.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% endblock %}
66

77
{% block content %}
8-
<section class="hero is-large is-link">
8+
<section class="hero is-medium is-dark">
99
<div class="hero-body">
1010
<div class="container has-text-centered">
1111
<h1 class="title is-1 pb-2">
@@ -14,7 +14,7 @@ <h1 class="title is-1 pb-2">
1414
<p class="subtitle is-4">
1515
You do not have permission to access this page.
1616
</p>
17-
<a href="{% url 'purl-list' %}" class="button is-dark">Explore available packages</a>
17+
<a href="{% url 'purl-list' %}" class="button is-info">Explore available packages</a>
1818
</div>
1919
</div>
2020
</section>

fedcode/templates/404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% endblock %}
66

77
{% block content %}
8-
<section class="hero is-large is-link">
8+
<section class="hero is-medium is-dark">
99
<div class="hero-body">
1010
<div class="container has-text-centered">
1111
<h1 class="title is-1 pb-2">
@@ -14,7 +14,7 @@ <h1 class="title is-1 pb-2">
1414
<p class="subtitle is-4">
1515
Sorry, the page you're looking for does not exist.
1616
</p>
17-
<a href="{% url 'purl-list' %}" class="button is-dark">Explore available packages</a>
17+
<a href="{% url 'purl-list' %}" class="button is-info">Explore available packages</a>
1818
</div>
1919
</div>
2020
</section>

fedcode/views.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def wrapper(request, *args, **kwargs):
234234
if hasattr(request.user, "service"):
235235
return view(request, *args, **kwargs)
236236
else:
237-
return HttpResponseForbidden()
237+
raise PermissionDenied("You are not authorized to view this page.")
238238

239239
return wrapper
240240

@@ -887,11 +887,3 @@ def revoke_token(request):
887887
},
888888
)
889889
return JsonResponse(json.loads(r.content), status=r.status_code, content_type=AP_CONTENT_TYPE)
890-
891-
892-
def permission_denied(request, exception=None):
893-
return render(request, "403.html", {})
894-
895-
896-
def page_not_found(request, exception=None):
897-
return render(request, "404.html", {})

federatedcode/settings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,3 @@
280280
"django.contrib.auth.backends.ModelBackend",
281281
"oauth2_provider.backends.OAuth2Backend",
282282
)
283-
284-
HANDLER403 = "fedcode.views.permission_denied"
285-
HANDLER404 = "fedcode.views.page_not_found"

0 commit comments

Comments
 (0)