mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat: error pages that say what happened and what to do
The 403, 404 and 500 pages said "Oops!" and one generic sentence; a bad request and a failed CSRF check fell back to Django's plain pages. Every error page now shares templates/error.html: a card with the status in a coloured badge with an icon, a heading in plain words, what happened and what to do, and Back and Home buttons. It uses only theme-defined Bootstrap classes, so it reads in the light and dark themes alike. - 400: the request was not accepted; a new address belongs in ALLOWED_HOSTS. - 403: the account lacks the permission; ask an administrator. - 403 CSRF: the form's security check failed; reload and submit again, and where to look when it happens on every form. - 404: the path, and that the object may be gone or hidden from the account. - 500: a libvirt failure on a page says the host's data could not be loaded, under libvirt's message; any other failure says it was logged and shows the time to give an administrator.
This commit is contained in:
parent
c3c84d780c
commit
10eb0d1c2e
8 changed files with 140 additions and 33 deletions
|
|
@ -1,15 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "error.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "404" %}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
<h1>{% trans 'Oops!'%}</h1>
|
||||
|
||||
<p class="lead">{% trans "404 Not Found" %}</p>
|
||||
{% block title %}{% trans "Page not found" %}{% endblock %}
|
||||
{% block code %}404{% endblock %}
|
||||
{% block status_classes %}text-bg-secondary{% endblock %}
|
||||
{% block icon %}bi-file-earmark-x{% endblock %}
|
||||
{% block heading %}{% trans "Page not found" %}{% endblock %}
|
||||
|
||||
<p>{% trans "The requested page was not found on this server." %}</p>
|
||||
<a class="btn btn-success" href="javascript:history.back()">← {% trans 'Back'%}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% block text %}
|
||||
<p class="mb-3">{% blocktrans with path=request_path %}Nothing was found at <code>{{ path }}</code>, or your account cannot see it.{% endblocktrans %}</p>
|
||||
<p class="text-body-secondary mb-0">{% trans "The virtual machine or host may have been deleted, or the link is wrong." %}</p>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue