Store Session.validated rather than Session.expires. Already handled in db migration that drops old sessions.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user