UI: Automatically refresh page on logout (#12035)
This commit is contained in:
parent
ec4b1b69d3
commit
50e5e2f48a
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Automatically refresh the page when user logs out
|
||||||
|
```
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Ember from 'ember';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
@ -16,7 +17,9 @@ export default Route.extend(ModelBoundaryRoute, {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
beforeModel() {
|
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.auth.deleteCurrentToken();
|
||||||
this.controlGroup.deleteTokens();
|
this.controlGroup.deleteTokens();
|
||||||
this.namespaceService.reset();
|
this.namespaceService.reset();
|
||||||
|
@ -24,6 +27,15 @@ export default Route.extend(ModelBoundaryRoute, {
|
||||||
this.console.clearLog(true);
|
this.console.clearLog(true);
|
||||||
this.flashMessages.clearMessages();
|
this.flashMessages.clearMessages();
|
||||||
this.permissions.reset();
|
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}`);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue