diff --git a/.env.example b/.env.example index 8ee75b9a..8412d7d2 100644 --- a/.env.example +++ b/.env.example @@ -15,6 +15,7 @@ LNBITS_ALLOWED_IPS="" LNBITS_BLOCKED_IPS="" # Allow users and admins by user IDs (comma separated list) +# if set new users will not be able to create accounts LNBITS_ALLOWED_USERS="" LNBITS_ADMIN_USERS="" # Extensions only admin can access diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 6df09d39..ebb06fbd 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -172,6 +172,11 @@ async def api_create_wallet( @api_router.post("/api/v1/account", response_model=Wallet) async def api_create_account(data: CreateWallet) -> Wallet: + if len(settings.lnbits_allowed_users) > 0: + raise HTTPException( + status_code=HTTPStatus.BAD_REQUEST, + detail="Account creation is disabled.", + ) account = await create_account() return await create_wallet(user_id=account.id, wallet_name=data.name)