Skip to content

Commit ed8d36b

Browse files
authored
UI: Automatically refresh page on logout (#12035) (#12082)
1 parent df0c8d3 commit ed8d36b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

changelog/12035.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
ui: Automatically refresh the page when user logs out
3+
```

ui/app/routes/vault/cluster/logout.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Ember from 'ember';
12
import { computed } from '@ember/object';
23
import { inject as service } from '@ember/service';
34
import Route from '@ember/routing/route';
@@ -16,14 +17,25 @@ export default Route.extend(ModelBoundaryRoute, {
1617
}),
1718

1819
beforeModel() {
19-
let authType = this.auth.getAuthType();
20+
const authType = this.auth.getAuthType();
21+
const baseUrl = window.location.origin;
22+
const ns = this.namespaceService.path;
2023
this.auth.deleteCurrentToken();
2124
this.controlGroup.deleteTokens();
2225
this.namespaceService.reset();
2326
this.console.set('isOpen', false);
2427
this.console.clearLog(true);
2528
this.flashMessages.clearMessages();
2629
this.permissions.reset();
27-
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
30+
if (Ember.testing) {
31+
// Don't redirect on the test
32+
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
33+
} else {
34+
let params = `?with=${authType}`;
35+
if (ns) {
36+
params = `${params}&namespace=${ns}`;
37+
}
38+
location.assign(`${baseUrl}/ui/vault/auth${params}`);
39+
}
2840
},
2941
});

0 commit comments

Comments
 (0)