From f8b364402975df372a751e9aeb24b2446aec8c06 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 29 Apr 2025 15:28:04 +0300 Subject: [PATCH] fix: auto redirect to home page when 401 (#3131) --- lnbits/templates/error.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lnbits/templates/error.html b/lnbits/templates/error.html index 6d5a9afa..6fdb8bcd 100644 --- a/lnbits/templates/error.html +++ b/lnbits/templates/error.html @@ -6,7 +6,7 @@ > {% block page %}
-
+
@@ -88,8 +88,15 @@ }, created() { this.err = '{{ err }}' - this.statusCode = '{{ status_code }}' || 404 + const statusCode = '{{ status_code }}' || 404 this.message = String({{ message | tojson }}) || 'Page not found' + if (statusCode == 401) { + console.warn(`Unauthorized: ${this.message}`) + this.goHome() + return + } + this.statusCode = statusCode + if (this.isExtension) { this.extension = this.message.match(/'([^']+)'/)[1] }