Skip to content

Commit

Permalink
UI: Automatically refresh page on logout (#12035) (#12080)
Browse files Browse the repository at this point in the history
  • Loading branch information
hashishaw authored Jul 15, 2021
1 parent f8ba333 commit d7cb1ff
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 d7cb1ff

Please sign in to comment.