diff --git a/api/routers/core_dynamic.py b/api/routers/core_dynamic.py index dfadd05c75..2825cec4b8 100644 --- a/api/routers/core_dynamic.py +++ b/api/routers/core_dynamic.py @@ -30,7 +30,6 @@ async def get_all_signup(): "edition": license.EDITION}} - if not tenants.tenants_exists_sync(use_pool=False): @public_app.post('/signup', tags=['signup']) @public_app.put('/signup', tags=['signup']) @@ -101,10 +100,15 @@ def refresh_login(context: schemas.CurrentContext = Depends(OR_context)): @app.get('/account', tags=['accounts']) def get_account(context: schemas.CurrentContext = Depends(OR_context)): r = users.get(tenant_id=context.tenant_id, user_id=context.user_id) + if r is None: + return {"errors": ["current user not found"]} t = tenants.get_by_tenant_id(context.tenant_id) if t is not None: t["createdAt"] = TimeUTC.datetime_to_timestamp(t["createdAt"]) t["tenantName"] = t.pop("name") + else: + return {"errors": ["current tenant not found"]} + return { 'data': { **r, diff --git a/ee/api/routers/core_dynamic.py b/ee/api/routers/core_dynamic.py index bc51a803df..000b5e1606 100644 --- a/ee/api/routers/core_dynamic.py +++ b/ee/api/routers/core_dynamic.py @@ -105,10 +105,15 @@ def refresh_login(context: schemas.CurrentContext = Depends(OR_context)): @app.get('/account', tags=['accounts']) def get_account(context: schemas.CurrentContext = Depends(OR_context)): r = users.get(tenant_id=context.tenant_id, user_id=context.user_id) + if r is None: + return {"errors": ["current user not found"]} t = tenants.get_by_tenant_id(context.tenant_id) if t is not None: t["createdAt"] = TimeUTC.datetime_to_timestamp(t["createdAt"]) t["tenantName"] = t.pop("name") + else: + return {"errors": ["current tenant not found"]} + return { 'data': { **r,