fix(ui): allow super users to bypass custom frontend redirect
Some checks are pending
LNbits CI / lint (push) Waiting to run
LNbits CI / test-api (, 3.10) (push) Blocked by required conditions
LNbits CI / test-api (, 3.11) (push) Blocked by required conditions
LNbits CI / test-api (, 3.12) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.10) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.11) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.12) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.10) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.11) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.12) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / migration (3.10) (push) Blocked by required conditions
LNbits CI / migration (3.11) (push) Blocked by required conditions
LNbits CI / migration (3.12) (push) Blocked by required conditions
LNbits CI / openapi (push) Blocked by required conditions
LNbits CI / regtest (BoltzWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (CoreLightningRestWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (CoreLightningWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (EclairWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LNbitsWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LndRestWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LndWallet, 3.10) (push) Blocked by required conditions
LNbits CI / jmeter (3.10) (push) Blocked by required conditions
codeql / analyze (push) Waiting to run
Some checks are pending
LNbits CI / lint (push) Waiting to run
LNbits CI / test-api (, 3.10) (push) Blocked by required conditions
LNbits CI / test-api (, 3.11) (push) Blocked by required conditions
LNbits CI / test-api (, 3.12) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.10) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.11) (push) Blocked by required conditions
LNbits CI / test-wallets (, 3.12) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.10) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.11) (push) Blocked by required conditions
LNbits CI / test-unit (, 3.12) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (push) Blocked by required conditions
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (push) Blocked by required conditions
LNbits CI / migration (3.10) (push) Blocked by required conditions
LNbits CI / migration (3.11) (push) Blocked by required conditions
LNbits CI / migration (3.12) (push) Blocked by required conditions
LNbits CI / openapi (push) Blocked by required conditions
LNbits CI / regtest (BoltzWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (CoreLightningRestWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (CoreLightningWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (EclairWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LNbitsWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LndRestWallet, 3.10) (push) Blocked by required conditions
LNbits CI / regtest (LndWallet, 3.10) (push) Blocked by required conditions
LNbits CI / jmeter (3.10) (push) Blocked by required conditions
codeql / analyze (push) Waiting to run
Super users now stay in the LNbits interface instead of being redirected to the custom frontend URL. This allows admins to manage the system while regular users are redirected. Centralizes redirect logic in refreshAuthUser() to check super_user flag before deciding where to redirect. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
85c7e13a27
commit
17e698b623
2 changed files with 20 additions and 33 deletions
2
lnbits/static/bundle-components.min.js
vendored
2
lnbits/static/bundle-components.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -79,12 +79,7 @@ window.PageHome = {
|
|||
this.password,
|
||||
this.passwordRepeat
|
||||
)
|
||||
// Redirect to custom frontend URL if configured, otherwise use router
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
this.refreshAuthUser()
|
||||
}
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
|
|
@ -96,12 +91,7 @@ window.PageHome = {
|
|||
this.password,
|
||||
this.passwordRepeat
|
||||
)
|
||||
// Redirect to custom frontend URL if configured, otherwise use router
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
this.refreshAuthUser()
|
||||
}
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
|
|
@ -109,12 +99,7 @@ window.PageHome = {
|
|||
async login() {
|
||||
try {
|
||||
await LNbits.api.login(this.username, this.password)
|
||||
// Redirect to custom frontend URL if configured, otherwise use router
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
this.refreshAuthUser()
|
||||
}
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
|
|
@ -123,12 +108,7 @@ window.PageHome = {
|
|||
try {
|
||||
await LNbits.api.loginUsr(this.usr)
|
||||
this.usr = ''
|
||||
// Redirect to custom frontend URL if configured, otherwise use router
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
this.refreshAuthUser()
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e)
|
||||
LNbits.utils.notifyApiError(e)
|
||||
|
|
@ -139,7 +119,19 @@ window.PageHome = {
|
|||
const res = await LNbits.api.getAuthUser()
|
||||
this.g.user = LNbits.map.user(res.data)
|
||||
this.g.isPublicPage = false
|
||||
|
||||
// Super users always go to LNbits interface
|
||||
if (this.g.user.super_user) {
|
||||
this.$router.push(`/wallet/${this.g.user.wallets[0].id}`)
|
||||
return
|
||||
}
|
||||
|
||||
// Redirect to custom frontend URL if configured
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
this.$router.push(`/wallet/${this.g.user.wallets[0].id}`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e)
|
||||
LNbits.utils.notifyApiError(e)
|
||||
|
|
@ -171,15 +163,10 @@ window.PageHome = {
|
|||
return // Don't redirect to /wallet
|
||||
}
|
||||
|
||||
// Redirect authorized users
|
||||
// Redirect authorized users (refreshAuthUser handles super_user check)
|
||||
if (this.g.isUserAuthorized) {
|
||||
// Redirect to custom frontend URL if configured, otherwise use router
|
||||
if (this.LNBITS_CUSTOM_FRONTEND_URL) {
|
||||
window.location.href = this.LNBITS_CUSTOM_FRONTEND_URL
|
||||
} else {
|
||||
return this.refreshAuthUser()
|
||||
}
|
||||
}
|
||||
|
||||
// check if lightning parameters are present in the URL
|
||||
if (urlParams.has('lightning')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue