Fix #3701 -- Don't use static cookie_domain on custom domains (#3728)

This commit is contained in:
Mira
2023-11-20 11:33:45 +01:00
committed by GitHub
parent 78609613bc
commit 65dbf03a12
2 changed files with 4 additions and 2 deletions

View File

@@ -54,6 +54,7 @@ from pretix.base.models import (
from pretix.base.services.cart import get_fees from pretix.base.services.cart import get_fees
from pretix.base.templatetags.money import money_filter from pretix.base.templatetags.money import money_filter
from pretix.helpers.cookies import set_cookie_without_samesite from pretix.helpers.cookies import set_cookie_without_samesite
from pretix.multidomain.middlewares import get_cookie_domain
from pretix.multidomain.urlreverse import eventreverse from pretix.multidomain.urlreverse import eventreverse
from pretix.presale.signals import question_form_fields from pretix.presale.signals import question_form_fields
@@ -468,7 +469,7 @@ def iframe_entry_view_wrapper(view_func):
locale, locale,
max_age=max_age, max_age=max_age,
expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime('%a, %d-%b-%Y %H:%M:%S GMT'), expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime('%a, %d-%b-%Y %H:%M:%S GMT'),
domain=settings.SESSION_COOKIE_DOMAIN domain=get_cookie_domain(request)
) )
return resp return resp

View File

@@ -40,6 +40,7 @@ from django.utils.http import url_has_allowed_host_and_scheme
from django.views.generic import View from django.views.generic import View
from pretix.helpers.cookies import set_cookie_without_samesite from pretix.helpers.cookies import set_cookie_without_samesite
from pretix.multidomain.middlewares import get_cookie_domain
from .robots import NoSearchIndexViewMixin from .robots import NoSearchIndexViewMixin
@@ -62,7 +63,7 @@ class LocaleSet(NoSearchIndexViewMixin, View):
max_age=max_age, max_age=max_age,
expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime( expires=(datetime.utcnow() + timedelta(seconds=max_age)).strftime(
'%a, %d-%b-%Y %H:%M:%S GMT'), '%a, %d-%b-%Y %H:%M:%S GMT'),
domain=settings.SESSION_COOKIE_DOMAIN domain=get_cookie_domain(request)
) )
return resp return resp