forked from CGM_Public/pretix_original
Require a session to be present at all times, not just in pretix.presale views
This commit is contained in:
@@ -67,6 +67,14 @@ class SessionMiddleware(BaseSessionMiddleware):
|
||||
a custom domain.
|
||||
"""
|
||||
|
||||
def process_request(self, request):
|
||||
super().process_request(request)
|
||||
|
||||
if not request.session.session_key:
|
||||
# We need to create session even if we do not yet store something there, because we need the session
|
||||
# key for e.g. saving the user's cart
|
||||
request.session.create()
|
||||
|
||||
def process_response(self, request, response):
|
||||
try:
|
||||
accessed = request.session.accessed
|
||||
|
||||
@@ -18,11 +18,6 @@ class EventMiddleware(MiddlewareMixin):
|
||||
if redirect:
|
||||
return redirect
|
||||
|
||||
if '_' not in request.session:
|
||||
# We need to create session even if we do not yet store something there, because we need the session
|
||||
# key for e.g. saving the user's cart
|
||||
request.session['_'] = '_'
|
||||
|
||||
def process_response(self, request, response):
|
||||
if hasattr(request, '_namespace') and request._namespace == 'presale' and hasattr(request, 'event'):
|
||||
for receiver, r in process_response.send(request.event, request=request, response=response):
|
||||
|
||||
Reference in New Issue
Block a user