From e04a9699a743616e9485309cc9cf0e6c5b8cd2ea Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Sat, 10 Apr 2021 10:21:21 +0200 Subject: [PATCH 1/2] Revert "fix: redirect to login if stored credentials are invalid" --- src/components/appRouter.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/appRouter.js b/src/components/appRouter.js index 7be3f652b..f7b41d77f 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -425,18 +425,14 @@ class AppRouter { onRequestFail(e, data) { const apiClient = this; - // 401 means the credentials are broken - if (data.status === 401) { - console.debug('Invalid stored credentials, redirecting to login'); - appRouter.showLocalLogin(apiClient.serverId()); - } else if (data.status === 403) { + if (data.status === 403) { if (data.errorCode === 'ParentalControl') { - const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true; + const isCurrentAllowed = this.currentRouteInfo ? (this.currentRouteInfo.route.anonymous || this.currentRouteInfo.route.startup) : true; // Bounce to the login screen, but not if a password entry fails, obviously if (!isCurrentAllowed) { - appRouter.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater')); - appRouter.showLocalLogin(apiClient.serverId()); + this.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater')); + this.showLocalLogin(apiClient.serverId()); } } } From 19501261410638a9ca73059c1ca68a224d10d874 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Sat, 10 Apr 2021 11:45:55 +0200 Subject: [PATCH 2/2] fix --- src/components/appRouter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/appRouter.js b/src/components/appRouter.js index f7b41d77f..28cf91ef1 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -427,12 +427,12 @@ class AppRouter { if (data.status === 403) { if (data.errorCode === 'ParentalControl') { - const isCurrentAllowed = this.currentRouteInfo ? (this.currentRouteInfo.route.anonymous || this.currentRouteInfo.route.startup) : true; + const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true; // Bounce to the login screen, but not if a password entry fails, obviously if (!isCurrentAllowed) { - this.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater')); - this.showLocalLogin(apiClient.serverId()); + appRouter.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater')); + appRouter.showLocalLogin(apiClient.serverId()); } } }