diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index 63f7af68..83648c44 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -133,19 +133,12 @@ async def wallet( return template_renderer().TemplateResponse( "error.html", {"request": request, "err": "User does not exist."} ) - try: - if LNBITS_ALLOWED_USERS and user_id not in LNBITS_ALLOWED_USERS: - return template_renderer().TemplateResponse( - "error.html", {"request": request, "err": "User not authorized."} - ) - except: - pass - - try: - if LNBITS_ADMIN_USERS and user_id in LNBITS_ADMIN_USERS: - user.admin = True - except: - pass + if LNBITS_ALLOWED_USERS and user_id not in LNBITS_ALLOWED_USERS: + return template_renderer().TemplateResponse( + "error.html", {"request": request, "err": "User not authorized."} + ) + if LNBITS_ADMIN_USERS and user_id in LNBITS_ADMIN_USERS: + user.admin = True if not wallet_id: if user.wallets and not wallet_name: # type: ignore wallet = user.wallets[0] # type: ignore diff --git a/lnbits/decorators.py b/lnbits/decorators.py index 904ca1c2..dd26d8fe 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -245,6 +245,4 @@ async def check_user_exists(usr: UUID4) -> User: ) if LNBITS_ADMIN_USERS and g().user.id in LNBITS_ADMIN_USERS: g().user.admin = True - except: - pass return g().user