mirror of https://github.com/portainer/portainer
fix(auth): clean browser cache on logout (#3402)
parent
e19bc8abc7
commit
ea1ca76f70
|
@ -125,6 +125,9 @@ angular.module('portainer.app')
|
||||||
getJobImage: function() {
|
getJobImage: function() {
|
||||||
return localStorageService.get('job_image');
|
return localStorageService.get('job_image');
|
||||||
},
|
},
|
||||||
|
storeLogoutReason: (reason) => localStorageService.set('logout_reason', reason),
|
||||||
|
getLogoutReason: () => localStorageService.get('logout_reason'),
|
||||||
|
cleanLogoutReason: () => localStorageService.remove('logout_reason'),
|
||||||
clean: function() {
|
clean: function() {
|
||||||
localStorageService.clearAll();
|
localStorageService.clearAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,12 @@ import uuidv4 from 'uuid/v4';
|
||||||
|
|
||||||
class AuthenticationController {
|
class AuthenticationController {
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor($async, $scope, $state, $stateParams, $sanitize, Authentication, UserService, EndpointService, ExtensionService, StateManager, Notifications, SettingsService, URLHelper, LocalStorage, StatusService) {
|
constructor($async, $scope, $state, $stateParams, $sanitize, $window, Authentication, UserService, EndpointService, ExtensionService, StateManager, Notifications, SettingsService, URLHelper, LocalStorage, StatusService) {
|
||||||
this.$async = $async;
|
this.$async = $async;
|
||||||
this.$scope = $scope;
|
this.$scope = $scope;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.$stateParams = $stateParams;
|
this.$stateParams = $stateParams;
|
||||||
|
this.$window = $window;
|
||||||
this.$sanitize = $sanitize;
|
this.$sanitize = $sanitize;
|
||||||
this.Authentication = Authentication;
|
this.Authentication = Authentication;
|
||||||
this.UserService = UserService;
|
this.UserService = UserService;
|
||||||
|
@ -51,10 +52,12 @@ class AuthenticationController {
|
||||||
* UTILS FUNCTIONS SECTION
|
* UTILS FUNCTIONS SECTION
|
||||||
*/
|
*/
|
||||||
|
|
||||||
logout() {
|
logout(error) {
|
||||||
this.Authentication.logout();
|
this.Authentication.logout();
|
||||||
this.state.loginInProgress = false;
|
this.state.loginInProgress = false;
|
||||||
this.generateOAuthLoginURI();
|
this.generateOAuthLoginURI();
|
||||||
|
this.LocalStorage.storeLogoutReason(error);
|
||||||
|
this.$window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
error(err, message) {
|
error(err, message) {
|
||||||
|
@ -250,8 +253,13 @@ class AuthenticationController {
|
||||||
this.generateOAuthLoginURI();
|
this.generateOAuthLoginURI();
|
||||||
|
|
||||||
if (this.$stateParams.logout || this.$stateParams.error) {
|
if (this.$stateParams.logout || this.$stateParams.error) {
|
||||||
this.logout();
|
this.logout(this.$stateParams.error);
|
||||||
this.state.AuthenticationError = this.$stateParams.error;
|
return;
|
||||||
|
}
|
||||||
|
const error = this.LocalStorage.getLogoutReason();
|
||||||
|
if (error) {
|
||||||
|
this.state.AuthenticationError = error;
|
||||||
|
this.LocalStorage.cleanLogoutReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Authentication.isAuthenticated()) {
|
if (this.Authentication.isAuthenticated()) {
|
||||||
|
|
Loading…
Reference in New Issue