mirror of https://github.com/zulip/zulip.git
Set session cookie domain for *.e.zulip.com hostnames.
(imported from commit 42b15de3b4576341304041588ffaceac6f40baaf)
This commit is contained in:
parent
7e786d5426
commit
eb1631f78d
|
@ -316,9 +316,13 @@ class SessionHostDomainMiddleware(SessionMiddleware):
|
|||
# Skip session save for 500 responses, refs #3881.
|
||||
if response.status_code != 500:
|
||||
request.session.save()
|
||||
host = request.get_host().split(':')[0]
|
||||
session_cookie_domain = settings.SESSION_COOKIE_DOMAIN
|
||||
if host.endswith(".e.zulip.com"):
|
||||
session_cookie_domain = ".e.zulip.com"
|
||||
response.set_cookie(settings.SESSION_COOKIE_NAME,
|
||||
request.session.session_key, max_age=max_age,
|
||||
expires=expires, domain=settings.SESSION_COOKIE_DOMAIN,
|
||||
expires=expires, domain=session_cookie_domain,
|
||||
path=settings.SESSION_COOKIE_PATH,
|
||||
secure=settings.SESSION_COOKIE_SECURE or None,
|
||||
httponly=settings.SESSION_COOKIE_HTTPONLY or None)
|
||||
|
|
Loading…
Reference in New Issue