[fix] fix multiple sessions
Session is created with user.id now instead of full user. Old sessions dont will destroy.
This commit is contained in:
parent
0570a9a32f
commit
81080404fb
|
@ -1,13 +1,12 @@
|
|||
import secrets
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from werkzeug.exceptions import Forbidden, Unauthorized
|
||||
|
||||
from ua_parser import user_agent_parser
|
||||
from werkzeug.exceptions import Forbidden, Unauthorized
|
||||
|
||||
from .. import logger
|
||||
from ..models import Session
|
||||
from ..database import db
|
||||
|
||||
from ..models import Session
|
||||
|
||||
lifetime = 1800
|
||||
|
||||
|
@ -72,7 +71,7 @@ def create(user, request_headers=None) -> Session:
|
|||
logger.debug(f"platform: {user_agent['os']['family']}, browser: {user_agent['user_agent']['family']}")
|
||||
session = Session(
|
||||
token=token_str,
|
||||
user_=user,
|
||||
_user_id=user.id_,
|
||||
lifetime=lifetime,
|
||||
platform=user_agent["os"]["family"],
|
||||
browser=user_agent["user_agent"]["family"],
|
||||
|
|
Loading…
Reference in New Issue