feat(webui): add sessions expiration
All checks were successful
main / main (push) Successful in 1m50s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped

Closes #28
This commit is contained in:
Julien Dessaux 2025-04-18 23:26:38 +02:00
parent d40595cacb
commit 372cc3a2c7
Signed by: adyxax
GPG key ID: F92E51B86E07177E
2 changed files with 3 additions and 3 deletions

View file

@ -17,6 +17,6 @@ type Session struct {
}
func (session *Session) IsExpired() bool {
// TODO
return false
expires := session.Created.Add(12 * time.Hour) // 12 hours sessions
return time.Now().After(expires)
}

View file

@ -86,7 +86,7 @@ func handleLoginPOST(db *database.DB) http.Handler {
Value: sessionId,
Quoted: false,
Path: "/",
MaxAge: 8 * 3600, // 1 hour sessions
MaxAge: 12 * 3600, // 12 hours sessions
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
Secure: true,