From 1eb7e6bacc161f4fa984735c76bf7bb226642196 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Thu, 28 Feb 2019 11:38:02 +1300 Subject: [PATCH] fix(auth): rollback changes introduced via #2591 (#2747) --- app/app.js | 4 ++-- app/portainer/__module.js | 4 ++-- app/portainer/views/auth/authController.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/app.js b/app/app.js index 9a7577c52..f1d2c14ca 100644 --- a/app/app.js +++ b/app/app.js @@ -44,8 +44,8 @@ function initAuthentication(authManager, Authentication, $rootScope, $state) { // authManager.redirectWhenUnauthenticated() + unauthenticatedRedirector // to have more controls on which URL should trigger the unauthenticated state. $rootScope.$on('unauthenticated', function (event, data) { - if (!_.includes(data.config.url, '/v2/') && ($state.current.name !== 'portainer.auth')) { - $state.go('portainer.auth', {error: 'Your session has expired', redirect: $state.current.name}); + if (!_.includes(data.config.url, '/v2/')) { + $state.go('portainer.auth', { error: 'Your session has expired' }); } }); } diff --git a/app/portainer/__module.js b/app/portainer/__module.js index d3cb2b46c..01adba1ab 100644 --- a/app/portainer/__module.js +++ b/app/portainer/__module.js @@ -48,7 +48,7 @@ angular.module('portainer.app', []) var authentication = { name: 'portainer.auth', - url: '/auth?redirect', + url: '/auth', params: { logout: false, error: '' @@ -329,7 +329,7 @@ angular.module('portainer.app', []) } }, resolve: { - endpointID: ['EndpointProvider', '$state', + endpointID: ['EndpointProvider', '$state', function (EndpointProvider, $state) { var id = EndpointProvider.endpointID(); if (!id) { diff --git a/app/portainer/views/auth/authController.js b/app/portainer/views/auth/authController.js index 2e2b729bf..055d359be 100644 --- a/app/portainer/views/auth/authController.js +++ b/app/portainer/views/auth/authController.js @@ -1,6 +1,6 @@ angular.module('portainer.app') -.controller('AuthenticationController', ['$q', '$scope', '$state', '$transition$', '$sanitize', 'Authentication', 'UserService', 'EndpointService', 'StateManager', 'Notifications', 'SettingsService', '$stateParams', -function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserService, EndpointService, StateManager, Notifications, SettingsService, $stateParams) { +.controller('AuthenticationController', ['$q', '$scope', '$state', '$transition$', '$sanitize', 'Authentication', 'UserService', 'EndpointService', 'StateManager', 'Notifications', 'SettingsService', +function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserService, EndpointService, StateManager, Notifications, SettingsService) { $scope.logo = StateManager.getState().application.logo; @@ -44,7 +44,7 @@ function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserServi if (endpoints.length === 0) { $state.go('portainer.init.endpoint'); } else { - $state.go($stateParams.redirect ||'portainer.home'); + $state.go('portainer.home'); } }) .catch(function error(err) { @@ -73,7 +73,7 @@ function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserServi if (endpoints.length === 0 && userDetails.role === 1) { $state.go('portainer.init.endpoint'); } else { - $state.go($stateParams.redirect || 'portainer.home'); + $state.go('portainer.home'); } }) .catch(function error(err) {