use persistent cookie instead of session cookie, expire in 18y
Jes Olson j3s@c3f.net
Wed, 22 Mar 2023 13:40:36 -0700
1 files changed,
5 insertions(+),
2 deletions(-)
jump to
M
site.go
→
site.go
@@ -9,6 +9,7 @@ "net/url"
"path/filepath" "strings" "text/template" + "time" "git.j3s.sh/vore/lib" "git.j3s.sh/vore/reaper"@@ -236,8 +237,10 @@ }
sessionToken := lib.GenerateSessionToken() s.db.SetSessionToken(username, sessionToken) http.SetCookie(w, &http.Cookie{ - Name: "session_token", - Value: sessionToken, + Name: "session_token", + // 18 years + Expires: time.Now().Add(time.Hour * 24 * 365 * 18), + Value: sessionToken, }) return nil }