mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Use custom error layout for shop offline
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
{% extends "error.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
{% block title %}{% trans "Shop offline" %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<i class="fa fa-fw fa-power-off big-icon"></i>
|
||||||
|
<div class="error-details">
|
||||||
|
<h1>{% trans "Shop offline" %}</h1>
|
||||||
|
<p>{% trans "This ticket shop is currently turned off." %}</p>
|
||||||
|
<p>{% trans "It is only accessible to authenticated team members." %}</p>
|
||||||
|
<p>{% trans "Please try again later." %}</p>
|
||||||
|
<p class="links">
|
||||||
|
<a id='goback' href='#'>{% trans "Take a step back" %}</a>
|
||||||
|
· <a id='reload' href='#'>{% trans "Try again" %}</a>
|
||||||
|
</p>
|
||||||
|
{% if request.user.is_staff and not staff_session %}
|
||||||
|
<form action="{% url 'control:user.sudo' %}?next={{ request.path|add:"?"|add:request.GET.urlencode|urlencode }}" method="post">
|
||||||
|
<p>
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-default" id="button-sudo">
|
||||||
|
<i class="fa fa-id-card"></i> {% trans "Admin mode" %}
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
<img src="{% static "pretixbase/img/pretix-logo.svg" %}" class="logo"/>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -38,17 +38,16 @@ from importlib import import_module
|
|||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import PermissionDenied
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import Http404
|
from django.http import Http404, HttpResponseForbidden
|
||||||
from django.middleware.csrf import rotate_token
|
from django.middleware.csrf import rotate_token
|
||||||
|
from django.template import loader
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.urls import resolve
|
from django.urls import resolve
|
||||||
from django.utils.crypto import constant_time_compare
|
from django.utils.crypto import constant_time_compare
|
||||||
from django.utils.functional import SimpleLazyObject
|
from django.utils.functional import SimpleLazyObject
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.defaults import permission_denied
|
|
||||||
from django_scopes import scope
|
from django_scopes import scope
|
||||||
|
|
||||||
from pretix.base.middleware import LocaleMiddleware
|
from pretix.base.middleware import LocaleMiddleware
|
||||||
@@ -325,8 +324,9 @@ def _detect_event(request, require_live=True, require_plugin=None):
|
|||||||
if not can_access:
|
if not can_access:
|
||||||
# Directly construct view instead of just calling `raise` since this case is so common that we
|
# Directly construct view instead of just calling `raise` since this case is so common that we
|
||||||
# don't want it to show in our log files.
|
# don't want it to show in our log files.
|
||||||
return permission_denied(
|
template = loader.get_template("pretixpresale/event/offline.html")
|
||||||
request, PermissionDenied(_('The selected ticket shop is currently not available.'))
|
return HttpResponseForbidden(
|
||||||
|
template.render(request=request)
|
||||||
)
|
)
|
||||||
|
|
||||||
if require_plugin:
|
if require_plugin:
|
||||||
|
|||||||
Reference in New Issue
Block a user