Flask Session -> Double Token

This commit is contained in:
喆OvO
2026-08-11 19:57:21 +08:00
parent 0fef309972
commit cbbb2e6d34
18 changed files with 1375 additions and 607 deletions
+3 -3
View File
@@ -41,11 +41,11 @@ def get_thread_user():
def _ctx_user_id():
"""Resolve the current user id: request session first, then thread-local."""
"""Resolve the current user id: request auth context first, then thread-local."""
try:
from flask import has_request_context, session
from flask import has_request_context, g
if has_request_context():
uid = session.get("user_id")
uid = getattr(g, "user_id", None)
if uid is not None:
return int(uid)
except Exception: