Flask Session -> Double Token
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user