diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index 3967e5e..c2ca1e1 100755 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -28,7 +28,10 @@ def get_client_ip(obj, request): return ip async def get_session_userinfo(request): - info = await auth.get_auth(request).split(':') + d = await auth.get_auth(request) + if d is None: + return DictObject() + info = d.split(':') return DictObject(**{ 'userid':info[0], 'username':info[1], @@ -36,12 +39,12 @@ async def get_session_userinfo(request): }) async def get_session_user(request): - userid = await get_session_userinfo(request).userid - return userid + userinfo = await get_session_userinfo(request) + return userinfo.userid async def user_login(request, userid, username='', userorgid=''): info = f'{userid}:{username}:{userorgid}' - await auth.remember(request, userinfo) + await auth.remember(request, info) async def user_logout(request): await auth.forget(request)