From 1aa2f01d29a25dd5fffac385afd3b5814e10b45c Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 21 Sep 2022 15:31:31 +0100 Subject: [PATCH] Added couple more tries --- lnbits/decorators.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lnbits/decorators.py b/lnbits/decorators.py index f951163f..a810892d 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -239,13 +239,16 @@ async def check_user_exists(usr: UUID4) -> User: if LNBITS_ADMIN_UI: LNBITS_ADMIN_USERS = g().admin_conf.admin_users LNBITS_ALLOWED_USERS = g().admin_conf.allowed_users - - if LNBITS_ALLOWED_USERS and g().user.id not in LNBITS_ALLOWED_USERS: - raise HTTPException( - status_code=HTTPStatus.UNAUTHORIZED, detail="User not authorized." - ) - - if LNBITS_ADMIN_USERS and g().user.id in LNBITS_ADMIN_USERS: - g().user.admin = True - + try: + if LNBITS_ALLOWED_USERS and g().user.id not in LNBITS_ALLOWED_USERS: + raise HTTPException( + status_code=HTTPStatus.UNAUTHORIZED, detail="User not authorized." + ) + except: + pass + try: + if LNBITS_ADMIN_USERS and g().user.id in LNBITS_ADMIN_USERS: + g().user.admin = True + except: + pass return g().user