Skip to content

Commit bfa2c01

Browse files
committed
set max_age for session cookie
1 parent 07df79f commit bfa2c01

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/langseed_web/endpoint.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ defmodule LangseedWeb.Endpoint do
44
# The session will be stored in the cookie and signed,
55
# this means its contents can be read but not tampered with.
66
# Set :encryption_salt if you would also like to encrypt it.
7+
#
8+
# Note: we set a `max_age` so the cookie survives browser restarts.
9+
# This should align with `Langseed.Accounts.UserToken` session validity.
10+
@session_max_age_in_seconds 14 * 24 * 60 * 60
711
@session_options [
812
store: :cookie,
913
key: "_langseed_key",
1014
signing_salt: "rX77hzhl",
11-
same_site: "Lax"
15+
same_site: "Lax",
16+
max_age: @session_max_age_in_seconds
1217
]
1318

1419
# Redirect www to non-www

0 commit comments

Comments
 (0)