Просмотр исходного кода

Closes #4945: Add a user-friendly 403 error page

Jeremy Stretch 5 лет назад
Родитель
Сommit
42ebf0a546

+ 2 - 1
docs/release-notes/version-2.9.md

@@ -5,7 +5,8 @@
 ### Enhancements
 
 * [#4919](https://github.com/netbox-community/netbox/issues/4919) - Allow adding/changing assigned permissions within group and user admin views
-* [#4940](https://github.com/netbox-community/netbox/issues/4940) - Added an `occupied` field to rack unit representations for rack elevation views
+* [#4940](https://github.com/netbox-community/netbox/issues/4940) - Add an `occupied` field to rack unit representations for rack elevation views
+* [#4945](https://github.com/netbox-community/netbox/issues/4945) - Add a user-friendly 403 error page
 
 ### Bug Fixes
 

+ 9 - 0
netbox/templates/403.html

@@ -0,0 +1,9 @@
+{% extends '40x.html' %}
+
+{% block title %}Access Denied{% endblock %}
+
+{% block icon %}<i class="glyphicon glyphicon-lock"></i>{% endblock %}
+
+{% block message %}
+    You do not have permission to access this page.
+{% endblock %}

+ 7 - 17
netbox/templates/404.html

@@ -1,19 +1,9 @@
-{% extends 'base.html' %}
+{% extends '40x.html' %}
 
-{% block content %}
-<div class="row" style="margin-top: 150px;">
-    <div class="col-sm-4 col-sm-offset-4">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong><i class="glyphicon glyphicon-warning-sign"></i> Page Not Found</strong>
-            </div>
-            <div class="panel-body">
-                The requested page does not exist.
-            </div>
-            <div class="panel-footer text-right">
-                <a href="{% url 'home' %}" class="btn btn-xs btn-primary">Home Page</a>
-            </div>
-        </div>
-    </div>
-</div>
+{% block title %}Page Not Found{% endblock %}
+
+{% block icon %}<i class="glyphicon glyphicon-warning-sign"></i>{% endblock %}
+
+{% block message %}
+    The requested page does not exist.
 {% endblock %}

+ 19 - 0
netbox/templates/40x.html

@@ -0,0 +1,19 @@
+{% extends 'base.html' %}
+
+{% block content %}
+<div class="row" style="margin-top: 150px;">
+    <div class="col-sm-4 col-sm-offset-4">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <strong>{% block icon %}{% endblock %} {% block title %}{% endblock %}</strong>
+            </div>
+            <div class="panel-body">
+                {% block message %}{% endblock %}
+            </div>
+            <div class="panel-footer text-right">
+                <a href="{% url 'home' %}" class="btn btn-xs btn-primary">Home Page</a>
+            </div>
+        </div>
+    </div>
+</div>
+{% endblock %}