Store Session.validated rather than Session.expires. Already handled in db migration that drops old sessions.

This commit is contained in:
Leo Vasanko
2026-02-18 01:57:01 +00:00
parent 205e7afde2
commit 22b72b2d50
11 changed files with 26 additions and 42 deletions
+1 -2
View File
@@ -2,7 +2,6 @@
from datetime import UTC, datetime
from paskia.authsession import EXPIRES
from paskia.db import SessionContext
from paskia.util.timeutil import parse_duration
@@ -32,7 +31,7 @@ def check_session_age(ctx: SessionContext, max_age: str | None) -> bool:
if ctx.credential and ctx.credential.last_used:
auth_time = ctx.credential.last_used
else:
auth_time = ctx.session.expiry - EXPIRES
auth_time = ctx.session.validated
time_since_auth = datetime.now(UTC) - auth_time
return time_since_auth <= max_age_delta