Skip to content

Commit

Permalink
Update domain on hedy cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
boryanagoncharenko committed Nov 26, 2024
1 parent a74d65b commit adf20a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions website/auth_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ def login(self, language='en'):
# We set the cookie to expire in a year,
# just so that the browser won't invalidate it if the same cookie gets renewed by constant use.
# The server will decide whether the cookie expires.

# e2e tests make calls from the domain 'localhost.local', so we need to not set the domain for the tests to work
domain = None if 'localhost' in config['domain_name'] else config['domain_name']
resp.set_cookie(
TOKEN_COOKIE_NAME,
value=cookie,
httponly=True,
secure=is_heroku(),
samesite="Strict",
domain=config["domain_name"],
domain=domain,
path="/",
max_age=365 * 24 * 60 * 60,
)
Expand Down Expand Up @@ -199,14 +202,17 @@ def signup(self, language='en'):
# We set the cookie to expire in a year,
# just so that the browser won't invalidate it if the same cookie gets renewed by constant use.
# The server will decide whether the cookie expires.

# e2e tests make calls from the domain 'localhost.local', so we need to not set the domain for the tests to work
domain = None if 'localhost' in config['domain_name'] else config['domain_name']
resp.set_cookie(
TOKEN_COOKIE_NAME,
value=cookie,
httponly=True,
secure=is_heroku(),
samesite="Strict",
path="/",
domain=config["domain_name"],
domain=domain,
max_age=365 * 24 * 60 * 60,
)

Expand Down

0 comments on commit adf20a8

Please sign in to comment.