Manage session properly.

This commit is contained in:
sfigato 2019-09-25 18:08:44 +02:00
parent 237daf771d
commit c0e0b0da82
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -165,7 +165,8 @@ async def logout_handler(request: web.Request) -> web.Response:
async def checkin_handler(request: web.Request) -> web.Response: async def checkin_handler(request: web.Request) -> web.Response:
alog.debug("checkin") alog.debug("checkin")
session = await get_session(request) 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: if not op:
return web.json_response( return web.json_response(
{"error": "No session", "logged_in": False}, status=401 {"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: async def checkout_handler(request: web.Request) -> web.Response:
alog.debug("checkout") alog.debug("checkout")
session = await get_session(request) 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: if not op:
return web.json_response( return web.json_response(
{"error": "No session", "logged_in": False}, status=401 {"error": "No session", "logged_in": False}, status=401