diff --git a/lnbits/core/crud/wallets.py b/lnbits/core/crud/wallets.py index 066ddd7b3..eaebf26a3 100644 --- a/lnbits/core/crud/wallets.py +++ b/lnbits/core/crud/wallets.py @@ -230,7 +230,10 @@ async def get_wallet_for_key( SELECT balance FROM balances WHERE wallet_id = wallets.id ), 0) AS balance_msat FROM wallets - WHERE (adminkey = :key OR inkey = :key) AND deleted = false + INNER JOIN accounts ON wallets.user = accounts.id + WHERE (adminkey = :key OR inkey = :key) + AND deleted = false + AND accounts.activated = true """, {"key": key}, Wallet, @@ -250,8 +253,11 @@ async def get_base_wallet_for_key( ) -> BaseWallet | None: wallet = await (conn or db).fetchone( """ - SELECT id, "user", wallet_type, adminkey, inkey FROM wallets - WHERE (adminkey = :key OR inkey = :key) AND deleted = false + SELECT wallets.id, "user", wallet_type, adminkey, inkey FROM wallets + INNER JOIN accounts ON wallets.user = accounts.id + WHERE (adminkey = :key OR inkey = :key) + AND deleted = false + AND accounts.activated = true """, {"key": key}, BaseWallet, diff --git a/lnbits/static/js/api.js b/lnbits/static/js/api.js index 4ad48c3a8..1617a1a9f 100644 --- a/lnbits/static/js/api.js +++ b/lnbits/static/js/api.js @@ -147,7 +147,7 @@ window._lnbitsApi = { name: name, wallet_type: walletType, ...opts - }).catch(LNbits.utils.notifyApiError) + }) }, updateWallet(name, wallet) { return this.request('patch', '/api/v1/wallet', wallet.adminkey, { diff --git a/lnbits/static/js/components/lnbits-wallet-new.js b/lnbits/static/js/components/lnbits-wallet-new.js index c427fd42b..cde9fb294 100644 --- a/lnbits/static/js/components/lnbits-wallet-new.js +++ b/lnbits/static/js/components/lnbits-wallet-new.js @@ -97,6 +97,7 @@ window.app.component('lnbits-wallet-new', { this.g.lastWalletId = res.data.id this.$router.push(`/wallet/${res.data.id}`) }) + .catch(LNbits.utils.notifyApiError) } }, created() {