Improve cookie detection and handling

This commit is contained in:
Raphael Michel
2018-09-02 15:25:33 +02:00
parent e18375ca6d
commit 6a4a8af731
8 changed files with 112 additions and 38 deletions

View File

@@ -0,0 +1,38 @@
{% extends "error.html" %}
{% load i18n %}
{% load eventurl %}
{% block content %}
{% if cart_namespace %}
<h1>{% trans "Please continue in a new tab" %}</h1>
<p class="larger">
{% blocktrans trimmed %}
Your browser is configured to block cookies from third-party website elements. Unfortunately, this
means we cannot show you this ticket shop embedded into the website. Please try to open the ticket
shop in a new tab or change your browser settings.
{% endblocktrans %}
</p>
<p class="larger">
{% blocktrans trimmed %}
We apologize for the inconvenience!
{% endblocktrans %}
</p>
<div class="text-center">
<a href="{{ url }}"
class="btn btn-primary btn-lg" target="_blank">
{% trans "Continue in new tab" %}
</a>
<script>
window.open('{{ url|escapejs }}');
</script>
</div>
{% else %}
<h1>{% trans "Cookies not supported" %}</h1>
<div class="alert alert-error">
{% blocktrans trimmed %}
Your browser does not accept cookies from us. However, we need to set a cookie to remember who
you are and what is in your cart. Please change your browser settings accordingly.
{% endblocktrans %}
</div>
{% endif %}
{% endblock %}

View File

@@ -106,29 +106,6 @@
</div>
{% endif %}
{% if cookie_warning %}
<div class="alert alert-danger">
{% if cart_namespace %}
{% blocktrans trimmed %}
Your browser does not accept cookies from us. However, we need to set a cookie to remember who
you are and what is in your cart. Please try to open the ticket shop in a new tab or change your
browser settings.
{% endblocktrans %}
<br>
<a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace %}{% if "cart_id" in request.GET %}?src=widget&take_cart_id={{ request.GET.cart_id }}{% endif %}"
class="btn btn-primary" target="_blank">
{% trans "Open ticket shop in new tab" %}
</a>
<div class="clearfix"></div>
{% else %}
{% blocktrans trimmed %}
Your browser does not accept cookies from us. However, we need to set a cookie to remember who
you are and what is in your cart. Please change your browser settings accordingly.
{% endblocktrans %}
{% endif %}
</div>
{% endif %}
{% if subevent or not event.has_subevents %}
{% if not ev.presale_is_running %}
<div class="alert alert-info">

View File

@@ -19,8 +19,9 @@
{% endblocktrans %}
</p>
{% if event.presale_is_running or event.settings.show_items_outside_presale_period %}
<form method="post" data-asynctask
action="{% eventurl request.event "presale:event.cart.add" cart_namespace=cart_namespace %}?next={% eventurl request.event "presale:event.index" cart_namespace=cart_namespace %}{% if "iframe" in request.GET %}&iframe={{ request.GET.iframe }}{% endif %}">
<form method="post"
action="{% eventurl request.event "presale:event.cart.add" cart_namespace=cart_namespace %}?next={% eventurl request.event "presale:event.index" cart_namespace=cart_namespace %}{% if "iframe" in request.GET and not new_tab %}&iframe={{ request.GET.iframe }}{% endif %}{% if "take_cart_id" in request.GET and new_tab %}&take_cart_id={{ request.GET.take_cart_id }}{% endif %}"
{% if new_tab %}target="_blank"{% else %}data-asynctask{% endif %}>
{% csrf_token %}
<input type="hidden" name="subevent" value="{{ subevent.id|default_if_none:"" }}" />
<input type="hidden" name="_voucher_code" value="{{ voucher.code }}">