mirror of https://github.com/portainer/portainer
feat(authentication): clean the state and the browser local storage on logout
parent
980f65a08a
commit
7e0b0a05de
|
@ -240,7 +240,7 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
initAdminUser: { method: 'POST', params: { username: 'admin', action: 'init' } }
|
||||
});
|
||||
}])
|
||||
.factory('Authentication', ['$q', '$rootScope', 'Auth', 'jwtHelper', 'LocalStorage', function AuthenticationFactory($q, $rootScope, Auth, jwtHelper, LocalStorage) {
|
||||
.factory('Authentication', ['$q', '$rootScope', 'Auth', 'jwtHelper', 'LocalStorage', 'StateManager', function AuthenticationFactory($q, $rootScope, Auth, jwtHelper, LocalStorage, StateManager) {
|
||||
'use strict';
|
||||
return {
|
||||
init: function() {
|
||||
|
@ -263,7 +263,8 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
});
|
||||
},
|
||||
logout: function() {
|
||||
LocalStorage.deleteJWT();
|
||||
StateManager.clean();
|
||||
LocalStorage.clean();
|
||||
},
|
||||
isAuthenticated: function() {
|
||||
var jwt = LocalStorage.getJWT();
|
||||
|
@ -343,6 +344,9 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
},
|
||||
deleteJWT: function() {
|
||||
localStorageService.remove('JWT');
|
||||
},
|
||||
clean: function() {
|
||||
localStorageService.clearAll();
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
@ -363,6 +367,9 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
}
|
||||
state.loading = false;
|
||||
},
|
||||
clean: function() {
|
||||
state.endpoint = {};
|
||||
},
|
||||
updateEndpointState: function(loading) {
|
||||
var deferred = $q.defer();
|
||||
if (loading) {
|
||||
|
|
Loading…
Reference in New Issue