fix super_user check, fixes #1250

This commit is contained in:
callebtc 2023-01-04 10:41:56 +01:00
parent b622028f7d
commit c96fd6783b
3 changed files with 14 additions and 19 deletions

View File

@ -11,7 +11,11 @@ LNBITS_ALLOWED_USERS=""
LNBITS_ADMIN_USERS="" LNBITS_ADMIN_USERS=""
# Extensions only admin can access # Extensions only admin can access
LNBITS_ADMIN_EXTENSIONS="ngrok, admin" LNBITS_ADMIN_EXTENSIONS="ngrok, admin"
# Enable Admin GUI, available for the first user in LNBITS_ADMIN_USERS if available # Enable Admin GUI, available for the first user in LNBITS_ADMIN_USERS if available
# Warning: Enabling this will make LNbits ignore this configuration file. Your settings will
# be stored in your database and you will be able to change them only through the Admin UI.
# Disable this to make LNbits use this config file again.
LNBITS_ADMIN_UI=false LNBITS_ADMIN_UI=false
LNBITS_DEFAULT_WALLET_NAME="LNbits wallet" LNBITS_DEFAULT_WALLET_NAME="LNbits wallet"

View File

@ -23,7 +23,7 @@
<strong>{% raw %}{{ formattedBalance }} {% endraw %}</strong> <strong>{% raw %}{{ formattedBalance }} {% endraw %}</strong>
{{LNBITS_DENOMINATION}} {{LNBITS_DENOMINATION}}
<q-btn <q-btn
v-if="'{{user.admin}}' == 'True'" v-if="'{{user.super_user}}' == 'True'"
flat flat
round round
color="primary" color="primary"
@ -36,27 +36,16 @@
v-model="credit" v-model="credit"
> >
<q-input <q-input
v-if="'{{LNBITS_DENOMINATION}}' != 'sats'" filled
label="Amount to credit account" label="{{LNBITS_DENOMINATION}} to credit"
hint="Press Enter to credit account"
v-model="scope.value" v-model="scope.value"
dense dense
autofocus autofocus
mask="#.##" :mask="'{{LNBITS_DENOMINATION}}' != 'sats' ? '#.##' : '#'"
fill-mask="0" fill-mask="0"
reverse-fill-mask reverse-fill-mask
@keyup.enter="updateBalance(scope.value)" :step="'{{LNBITS_DENOMINATION}}' != 'sats' ? '0.01' : '1'"
>
<template v-slot:append>
<q-icon name="edit" />
</template>
</q-input>
<q-input
v-else
type="number"
label="Amount to credit account"
v-model="scope.value"
dense
autofocus
@keyup.enter="updateBalance(scope.value)" @keyup.enter="updateBalance(scope.value)"
> >
<template v-slot:append> <template v-slot:append>
@ -479,10 +468,10 @@
dense dense
v-model.number="receive.data.amount" v-model.number="receive.data.amount"
:label="'Amount (' + receive.unit + ') *'" :label="'Amount (' + receive.unit + ') *'"
:mask="receive.unit != 'sat' ? '#.##' : '#'" :mask="receive.unit != 'sats' ? '#.##' : '#'"
fill-mask="0" fill-mask="0"
reverse-fill-mask reverse-fill-mask
:step="receive.unit != 'sat' ? '0.01' : '1'" :step="receive.unit != 'sats' ? '0.01' : '1'"
:min="receive.minMax[0]" :min="receive.minMax[0]"
:max="receive.minMax[1]" :max="receive.minMax[1]"
:readonly="receive.lnurl && receive.lnurl.fixed" :readonly="receive.lnurl && receive.lnurl.fixed"

View File

@ -131,6 +131,8 @@ async def wallet(
) )
if user_id == settings.super_user or user_id in settings.lnbits_admin_users: if user_id == settings.super_user or user_id in settings.lnbits_admin_users:
user.admin = True user.admin = True
if user_id == settings.super_user:
user.super_user = True
if not wallet_id: if not wallet_id:
if user.wallets and not wallet_name: # type: ignore if user.wallets and not wallet_name: # type: ignore