diff --git a/app/portainer/views/auth/authController.js b/app/portainer/views/auth/authController.js index a03e19109..9004d2cde 100644 --- a/app/portainer/views/auth/authController.js +++ b/app/portainer/views/auth/authController.js @@ -1,6 +1,7 @@ import angular from 'angular'; import uuidv4 from 'uuid/v4'; import { getEnvironments } from '@/react/portainer/environments/environment.service'; +import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper'; class AuthenticationController { /* @ngInject */ @@ -261,6 +262,9 @@ class AuthenticationController { this.LocalStorage.cleanLogoutReason(); } + // always clear the kubernetes cache on login + dispatchCacheRefreshEvent(); + if (this.Authentication.isAuthenticated()) { await this.postLoginSteps(); } diff --git a/app/portainer/views/logout/logoutController.js b/app/portainer/views/logout/logoutController.js index 244081c07..5369121d6 100644 --- a/app/portainer/views/logout/logoutController.js +++ b/app/portainer/views/logout/logoutController.js @@ -1,4 +1,5 @@ import angular from 'angular'; +import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper'; class LogoutController { /* @ngInject */ @@ -30,6 +31,9 @@ class LogoutController { try { await this.Authentication.logout(); } finally { + // always clear the kubernetes cache + dispatchCacheRefreshEvent(); + this.LocalStorage.storeLogoutReason(error); if (settings.OAuthLogoutURI && this.Authentication.getUserDetails().ID !== 1) { this.$window.location.href = settings.OAuthLogoutURI;