mirror of
https://github.com/pretix/pretix.git
synced 2026-08-09 10:37:50 +00:00
use cookieretry only on presale event pages
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
{% load anonymize_email %}
|
||||
{% block thetitle %}
|
||||
{% if messages %}
|
||||
{{ messages|join:" " }} ::
|
||||
{{ messages|join:" " }} ::
|
||||
{% endif %}
|
||||
{% block title %}{% endblock %}{% if request.resolver_match.url_name != "event.index" %} :: {% endif %}{{ event.name }}
|
||||
{% endblock %}
|
||||
@@ -26,6 +26,7 @@
|
||||
{% if event.settings.google_site_verification %}
|
||||
<meta name="google-site-verification" content="{{ event.settings.google_site_verification }}" />
|
||||
{% endif %}
|
||||
<script type="text/javascript" src="{% static "pretixpresale/js/csrfcookieretry.js" %}"></script>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% block above %}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const COOKIE_NAME = "__Host-pretix_csrftoken";
|
||||
const RELOAD_FLAG = "csrfReloadPerformed";
|
||||
|
||||
const hasCookie = document.cookie
|
||||
.split("; ")
|
||||
.some((c) => c.startsWith(COOKIE_NAME + "="));
|
||||
|
||||
if (!hasCookie && !sessionStorage.getItem(RELOAD_FLAG)) {
|
||||
sessionStorage.setItem(RELOAD_FLAG, "1");
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user