mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-14 02:34:27 +00:00
More logging for the admin session
This commit is contained in:
parent
ef4608f348
commit
fbc46e0517
1 changed files with 3 additions and 0 deletions
|
@ -61,14 +61,17 @@ async def user_session_or_redirect(
|
|||
)
|
||||
|
||||
if not session:
|
||||
logger.info("No existing admin session")
|
||||
raise _RedirectToLoginPage
|
||||
|
||||
try:
|
||||
loaded_session = session_serializer.loads(session, max_age=3600 * 24 * 3)
|
||||
except Exception:
|
||||
logger.exception("Failed to validate admin session")
|
||||
raise _RedirectToLoginPage
|
||||
|
||||
if not loaded_session.get("is_logged_in"):
|
||||
logger.info(f"Admin session invalidated: {loaded_session}")
|
||||
raise _RedirectToLoginPage
|
||||
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue