From b4c2e5d235b6a929ca924cd6c50c71f74d4a5482 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 11 Aug 2020 11:23:14 +0300 Subject: [PATCH] fix(auth): reject main route if logged out (#4197) --- app/portainer/__module.js | 1 + app/portainer/services/authentication.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/portainer/__module.js b/app/portainer/__module.js index 0e3aac20e..f13ac6d88 100644 --- a/app/portainer/__module.js +++ b/app/portainer/__module.js @@ -35,6 +35,7 @@ angular.module('portainer.app', ['portainer.oauth']).config([ await StateManager.initialize(); if (!loggedIn) { $state.go('portainer.auth'); + return Promise.reject('Unauthenticated'); } } catch (err) { Notifications.error('Failure', err, 'Unable to retrieve application settings'); diff --git a/app/portainer/services/authentication.js b/app/portainer/services/authentication.js index ed43666f6..c7e2af29a 100644 --- a/app/portainer/services/authentication.js +++ b/app/portainer/services/authentication.js @@ -31,7 +31,7 @@ angular.module('portainer.app').factory('Authentication', [ } return !!jwt; } catch (error) { - throw error; + return false; } }