mirror of
https://github.com/pretix/pretix.git
synced 2026-08-24 13:02:00 +00:00
Perform cookie check earlier
This commit is contained in:
@@ -182,7 +182,7 @@
|
||||
data-asynctask-headline="{% trans "We're now trying to reserve this for you!" %}"
|
||||
data-asynctask-text="{% blocktrans with time=event.settings.reservation_time %}Once the items are in your cart, you will have {{ time }} minutes to complete your purchase.{% endblocktrans %}"
|
||||
class="{% if event.seating_plan_id %}has-seating{% endif %}"
|
||||
action="{% eventurl request.event "presale:event.cart.add" cart_namespace=cart_namespace %}?next={{ cart_redirect|urlencode }}&next_error={{ request.path|urlencode }}{{ take_cart_id_param }}">
|
||||
action="{% eventurl request.event "presale:event.cart.add" cart_namespace=cart_namespace %}?next={{ cart_redirect|urlencode }}&next_error={{ request.path|urlencode }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="subevent" value="{{ subevent.id|default_if_none:"" }}" />
|
||||
{% if ev.seating_plan_id and event.settings.seating_choice %}
|
||||
|
||||
@@ -515,7 +515,12 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
}))
|
||||
elif request.GET.get('iframe', '') == '1' and len(self.request.GET.get('widget_data', '{}')) > 3:
|
||||
# We've been passed data from a widget, we need to create a cart session to store it.
|
||||
get_or_create_cart_id(request, cache_widget_data=True)
|
||||
return redirect_to_url(eventreverse(request.event, 'presale:event.index', kwargs=kwargs) + '?' + urlencode({
|
||||
'require_cookie': 'true',
|
||||
'cart_id': get_or_create_cart_id(request, cache_widget_data=True),
|
||||
**({"locale": request.GET.get('locale')} if request.GET.get('locale') else {}),
|
||||
**utm_params,
|
||||
}))
|
||||
elif 'require_cookie' in request.GET and settings.SESSION_COOKIE_NAME not in request.COOKIES and \
|
||||
'__Host-' + settings.SESSION_COOKIE_NAME not in self.request.COOKIES:
|
||||
# Cookies are in fact not supported
|
||||
@@ -644,10 +649,6 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
else:
|
||||
context['cart_redirect'] = self.request.path
|
||||
|
||||
if 'cart_namespace' in self.kwargs and self.request.GET.get('iframe') == '1' and 'take_cart_id' in self.request.GET:
|
||||
from pretix.presale.views.cart import get_or_create_cart_id
|
||||
context['take_cart_id_param'] = '&take_cart_id=' + get_or_create_cart_id(self.request)
|
||||
|
||||
return context
|
||||
|
||||
def _subevent_list_cachekey(self):
|
||||
|
||||
Reference in New Issue
Block a user