diff --git a/server/auth/router.py b/server/auth/router.py index 6a4b0855..66ee8ac2 100644 --- a/server/auth/router.py +++ b/server/auth/router.py @@ -47,8 +47,8 @@ async def callback(request: Request, auth_client: BaseAuthClient = Depends(get_a if user_info: upsert_user = { **user_info, - 'agreement_accepted': profile['agreement_accepted'], - 'is_admin': profile['is_admin'], + 'agreement_accepted': profile['agreement_accepted'] if profile else False, + 'is_admin': profile['is_admin'] if profile else False, } request.session["user"] = dict(upsert_user) diff --git a/server/core/dao/profilesDAO.py b/server/core/dao/profilesDAO.py index 707b7e25..fe0627d4 100644 --- a/server/core/dao/profilesDAO.py +++ b/server/core/dao/profilesDAO.py @@ -18,7 +18,7 @@ def get_profile(self, user_id: str): .eq('id', user_id) .execute() ) - return resp.data[0] + return resp.data[0] if resp.data else None def get_agreement_status(self, user_id: str):