From c0e0b0da82733b211cc3b345c90323d7cdde24ab Mon Sep 17 00:00:00 2001 From: blallo Date: Wed, 25 Sep 2019 18:08:44 +0200 Subject: [PATCH] Manage session properly. --- api/rest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/rest.py b/api/rest.py index f1ea4be..966e4c4 100644 --- a/api/rest.py +++ b/api/rest.py @@ -165,7 +165,8 @@ async def logout_handler(request: web.Request) -> web.Response: async def checkin_handler(request: web.Request) -> web.Response: alog.debug("checkin") session = await get_session(request) - op = OPERATORS.get(session.get("async_operator")) + user_session = USERS.get(session["async_operator"], UserSession("NOONE")) + op = OPERATORS.get(user_session) if not op: return web.json_response( {"error": "No session", "logged_in": False}, status=401 @@ -179,7 +180,8 @@ async def checkin_handler(request: web.Request) -> web.Response: async def checkout_handler(request: web.Request) -> web.Response: alog.debug("checkout") session = await get_session(request) - op = OPERATORS.get(session.get("async_operator")) + user_session = USERS.get(session["async_operator"], UserSession("NOONE")) + op = OPERATORS.get(user_session) if not op: return web.json_response( {"error": "No session", "logged_in": False}, status=401