mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-09 14:41:23 +02:00
Don't create user if allowed users is set (#1822)
* dont allow creating of users when allowed users are set
* add info to .env.example
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
parent
5b16f54857
commit
d79a55b4c6
@ -15,6 +15,7 @@ LNBITS_ALLOWED_IPS=""
|
|||||||
LNBITS_BLOCKED_IPS=""
|
LNBITS_BLOCKED_IPS=""
|
||||||
|
|
||||||
# Allow users and admins by user IDs (comma separated list)
|
# 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_ALLOWED_USERS=""
|
||||||
LNBITS_ADMIN_USERS=""
|
LNBITS_ADMIN_USERS=""
|
||||||
# Extensions only admin can access
|
# Extensions only admin can access
|
||||||
|
@ -172,6 +172,11 @@ async def api_create_wallet(
|
|||||||
|
|
||||||
@api_router.post("/api/v1/account", response_model=Wallet)
|
@api_router.post("/api/v1/account", response_model=Wallet)
|
||||||
async def api_create_account(data: CreateWallet) -> 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()
|
account = await create_account()
|
||||||
return await create_wallet(user_id=account.id, wallet_name=data.name)
|
return await create_wallet(user_id=account.id, wallet_name=data.name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user