fix(auth): rollback changes introduced via #2591 (#2747)

pull/2749/head
Anthony Lapenna 2019-02-28 11:38:02 +13:00 committed by GitHub
parent 9cbf1f34a7
commit 1eb7e6bacc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -44,8 +44,8 @@ function initAuthentication(authManager, Authentication, $rootScope, $state) {
// authManager.redirectWhenUnauthenticated() + unauthenticatedRedirector // authManager.redirectWhenUnauthenticated() + unauthenticatedRedirector
// to have more controls on which URL should trigger the unauthenticated state. // to have more controls on which URL should trigger the unauthenticated state.
$rootScope.$on('unauthenticated', function (event, data) { $rootScope.$on('unauthenticated', function (event, data) {
if (!_.includes(data.config.url, '/v2/') && ($state.current.name !== 'portainer.auth')) { if (!_.includes(data.config.url, '/v2/')) {
$state.go('portainer.auth', {error: 'Your session has expired', redirect: $state.current.name}); $state.go('portainer.auth', { error: 'Your session has expired' });
} }
}); });
} }

View File

@ -48,7 +48,7 @@ angular.module('portainer.app', [])
var authentication = { var authentication = {
name: 'portainer.auth', name: 'portainer.auth',
url: '/auth?redirect', url: '/auth',
params: { params: {
logout: false, logout: false,
error: '' error: ''

View File

@ -1,6 +1,6 @@
angular.module('portainer.app') angular.module('portainer.app')
.controller('AuthenticationController', ['$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, $stateParams) { function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserService, EndpointService, StateManager, Notifications, SettingsService) {
$scope.logo = StateManager.getState().application.logo; $scope.logo = StateManager.getState().application.logo;
@ -44,7 +44,7 @@ function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserServi
if (endpoints.length === 0) { if (endpoints.length === 0) {
$state.go('portainer.init.endpoint'); $state.go('portainer.init.endpoint');
} else { } else {
$state.go($stateParams.redirect ||'portainer.home'); $state.go('portainer.home');
} }
}) })
.catch(function error(err) { .catch(function error(err) {
@ -73,7 +73,7 @@ function ($q, $scope, $state, $transition$, $sanitize, Authentication, UserServi
if (endpoints.length === 0 && userDetails.role === 1) { if (endpoints.length === 0 && userDetails.role === 1) {
$state.go('portainer.init.endpoint'); $state.go('portainer.init.endpoint');
} else { } else {
$state.go($stateParams.redirect || 'portainer.home'); $state.go('portainer.home');
} }
}) })
.catch(function error(err) { .catch(function error(err) {