diff --git a/flaschengeist/controller/sessionController.py b/flaschengeist/controller/sessionController.py index afed11e..2c962f4 100644 --- a/flaschengeist/controller/sessionController.py +++ b/flaschengeist/controller/sessionController.py @@ -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"],