Skip to content

Commit

Permalink
UI: Automatically refresh page on logout (#12035)
Browse files Browse the repository at this point in the history
  • Loading branch information
hashishaw committed Jul 14, 2021
1 parent ef417a9 commit 2e0dcb7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/12035.txt
@@ -0,0 +1,3 @@
```release-note:bug
ui: Automatically refresh the page when user logs out
```
16 changes: 14 additions & 2 deletions ui/app/routes/vault/cluster/logout.js
@@ -1,3 +1,4 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
Expand All @@ -16,14 +17,25 @@ export default Route.extend(ModelBoundaryRoute, {
}),

beforeModel() {
let authType = this.auth.getAuthType();
const authType = this.auth.getAuthType();
const baseUrl = window.location.origin;
const ns = this.namespaceService.path;
this.auth.deleteCurrentToken();
this.controlGroup.deleteTokens();
this.namespaceService.reset();
this.console.set('isOpen', false);
this.console.clearLog(true);
this.flashMessages.clearMessages();
this.permissions.reset();
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
if (Ember.testing) {
// Don't redirect on the test
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
} else {
let params = `?with=${authType}`;
if (ns) {
params = `${params}&namespace=${ns}`;
}
location.assign(`${baseUrl}/ui/vault/auth${params}`);
}
},
});

0 comments on commit 2e0dcb7

Please sign in to comment.