From 15897d03707f40421e4704c3c885989820d6ac49 Mon Sep 17 00:00:00 2001 From: Jannis Portmann Date: Thu, 18 May 2023 14:03:35 +0200 Subject: [PATCH] Update error pages --- pflaenzli/pflaenzli/templates/403.html | 18 +++++++++++++++ pflaenzli/pflaenzli/templates/403_csrf.html | 18 +++++++++++++++ .../pflaenzli/templates/{error => }/404.html | 5 +--- pflaenzli/pflaenzli/templates/500.html | 18 +++++++++++++++ pflaenzli/pflaenzli/templates/error/500.html | 23 ------------------- pflaenzli/pflaenzli/views.py | 8 +++++-- pflaenzli/pflaenzli_django/urls.py | 1 + 7 files changed, 62 insertions(+), 29 deletions(-) create mode 100644 pflaenzli/pflaenzli/templates/403.html create mode 100644 pflaenzli/pflaenzli/templates/403_csrf.html rename pflaenzli/pflaenzli/templates/{error => }/404.html (67%) create mode 100644 pflaenzli/pflaenzli/templates/500.html delete mode 100644 pflaenzli/pflaenzli/templates/error/500.html diff --git a/pflaenzli/pflaenzli/templates/403.html b/pflaenzli/pflaenzli/templates/403.html new file mode 100644 index 0000000..75dc473 --- /dev/null +++ b/pflaenzli/pflaenzli/templates/403.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %} + {% trans "Not found" %} +{% endblock title %} +{% block content %} +
+

+ Error 403 {% trans "Forbidden" %} +

+

+ {% blocktrans %}Halt! You've reached a forbidden enclave. Access to this hidden sanctuary is restricted, and its secrets are reserved for chosen ones. We apologize for any inconvenience caused by this unattainable allure.Please explore the accessible realms of our botanical wonders while the forbidden gates remain sealed. If you think your worthy, please let your message reach us.{% endblocktrans %} +

+

{% trans "What now?" %}

+ {% trans "Go home" %} + {% trans "Report error" %} +
+{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/403_csrf.html b/pflaenzli/pflaenzli/templates/403_csrf.html new file mode 100644 index 0000000..541ecb2 --- /dev/null +++ b/pflaenzli/pflaenzli/templates/403_csrf.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %} + {% trans "Not found" %} +{% endblock title %} +{% block content %} +
+

+ Error 403 {% trans "Forbidden" %} ({% trans "CSRF verification failed" %}) +

+

+ {% blocktrans %}Halt! Only bearers of the CSRF token are allowed past this point. This protective enchantment prevents unauthorized actions and ensures security. Please ensure the validity of your session and attempt again. Should you seek further guidance, our plant mystics stands ready to lend their wisdom and support on your journey.{% endblocktrans %} +

+

{% trans "What now?" %}

+ {% trans "Go home" %} + {% trans "Report error" %} +
+{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/error/404.html b/pflaenzli/pflaenzli/templates/404.html similarity index 67% rename from pflaenzli/pflaenzli/templates/error/404.html rename to pflaenzli/pflaenzli/templates/404.html index 2bb9327..ab7fa5d 100644 --- a/pflaenzli/pflaenzli/templates/error/404.html +++ b/pflaenzli/pflaenzli/templates/404.html @@ -9,10 +9,7 @@ Error 404 {% trans "Page not found" %}

- {% blocktrans %} - Alas! Your path has led you astray in the depths of the enchanted forest. The elusive plant you seek has hidden - itself amidst the mystical foliage. If you have a map, please share it with us! - {% endblocktrans %} + {% blocktrans %}Alas! Your path has led you astray in the depths of the enchanted forest. The elusive plant you seek has hidden itself amidst the mystical foliage. If you have a map, please share it with us!{% endblocktrans %}

{% trans "What now?" %}

{% trans "Go home" %} diff --git a/pflaenzli/pflaenzli/templates/500.html b/pflaenzli/pflaenzli/templates/500.html new file mode 100644 index 0000000..79184d8 --- /dev/null +++ b/pflaenzli/pflaenzli/templates/500.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %} + {% trans "Not found" %} +{% endblock title %} +{% block content %} +
+

+ Error 500 {% trans "Forbidden" %} +

+

+ {% blocktrans %}Uh-oh! The delicate balance of the botanical realms has been disrupted. The forces of nature are in disarray, and our plant guardians are diligently working to restore harmony. We apologize for any inconvenience caused during this mystical turbulence. Please bear with us as we channel our magic to mend the rupture. Please contact us, if you have any information that could help to dispel the dark magic!{% endblocktrans %} +

+

{% trans "What now?" %}

+ {% trans "Go home" %} + {% trans "Report error" %} +
+{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/error/500.html b/pflaenzli/pflaenzli/templates/error/500.html deleted file mode 100644 index 45cda34..0000000 --- a/pflaenzli/pflaenzli/templates/error/500.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %} - {% trans "Not found" %} -{% endblock title %} -{% block content %} -
-

- Error 500 {% trans "Page not found" %} -

-

- {% blocktrans %} - Uh-oh! The delicate balance of the botanical realms has been disrupted. The forces of nature are in disarray, - and our plant guardians are diligently working to restore harmony. We apologize for any inconvenience caused - during this mystical turbulence. Please bear with us as we channel our magic to mend the rupture. Please - contact us, if you have any information that could help to disspell the dark magic! - {% endblocktrans %} -

-

{% trans "What now?" %}

- {% trans "Go home" %} - {% trans "Report error" %} -
-{% endblock content %} diff --git a/pflaenzli/pflaenzli/views.py b/pflaenzli/pflaenzli/views.py index 291c7f3..d7f9c63 100644 --- a/pflaenzli/pflaenzli/views.py +++ b/pflaenzli/pflaenzli/views.py @@ -185,11 +185,15 @@ def register_user(request): def error_404(request, exception): - return render(request, 'error/404.html') + return render(request, '404.html') + + +def error_403(request, exception): + return render(request, '403.html') def error_500(request): - return render(request, 'error/500.html') + return render(request, '500.html') def filter_offers(offers, form): diff --git a/pflaenzli/pflaenzli_django/urls.py b/pflaenzli/pflaenzli_django/urls.py index 8c81db0..08e12c8 100644 --- a/pflaenzli/pflaenzli_django/urls.py +++ b/pflaenzli/pflaenzli_django/urls.py @@ -28,4 +28,5 @@ urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) handler404 = 'pflaenzli.views.error_404' +handler403 = 'pflaenzli.views.error_403' handler500 = 'pflaenzli.views.error_500'