From ef467423ac5b0f7473fe71fbc088a78c8af9b539 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Sat, 5 Sep 2026 22:19:58 -0600 Subject: [PATCH] Fix set-active endpoint (PUT /users/:id/active) + add invite email --- app/main.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 513d1cb..13f2e97 100644 --- a/app/main.py +++ b/app/main.py @@ -203,14 +203,25 @@ async def cloudron_set_group(user_id: str) -> None: async def cloudron_set_active(user_id: str, active: bool) -> None: async with httpx.AsyncClient() as client: - r = await client.post( - f"{CLOUDRON_API}/api/v1/users/{user_id}", + r = await client.put( + f"{CLOUDRON_API}/api/v1/users/{user_id}/active", headers=cloudron_headers(), json={"active": active}, ) r.raise_for_status() +async def cloudron_send_invite(user_id: str, email: str) -> None: + """Send the account-setup invite email to the member.""" + async with httpx.AsyncClient() as client: + r = await client.post( + f"{CLOUDRON_API}/api/v1/users/{user_id}/send_invite_email", + headers=cloudron_headers(), + json={"email": email}, + ) + r.raise_for_status() + + async def litellm_create_key(email: str, budget: float) -> str: """Create a LiteLLM virtual key for a member with a budget cap.""" async with httpx.AsyncClient() as client: @@ -438,6 +449,7 @@ async def oauth_callback(request: Request): await cloudron_set_active(user_id, True) key_token = await litellm_create_key(email, MEMBER_BUDGET) store_member(email, key_token, user_id) + await cloudron_send_invite(user_id, email) logger.info("Provisioned member %s (user_id=%s)", email, user_id)