ui: make logout redirect to same auth method in login form (#8601)

* Make logging out of Web UI redirect to the login form using the same auth method that was previously used. This makes it less annoying to log back in again when your session expires.

* Address PR feedback.

Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com>
This commit is contained in:
Stefan Sundin
2020-04-02 14:48:10 -07:00
committed by GitHub
parent f82ad92595
commit 84fdc8966c
2 changed files with 6 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ export default Route.extend(ModelBoundaryRoute, {
}),
beforeModel() {
let authType = this.auth.getAuthType();
this.auth.deleteCurrentToken();
this.controlGroup.deleteTokens();
this.namespaceService.reset();
@@ -23,6 +24,6 @@ export default Route.extend(ModelBoundaryRoute, {
this.console.clearLog(true);
this.flashMessages.clearMessages();
this.permissions.reset();
this.replaceWith('vault.cluster.auth');
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
},
});

View File

@@ -333,6 +333,10 @@ export default Service.extend({
return authData;
},
getAuthType() {
return this.get('authData.backend.type');
},
deleteCurrentToken() {
const tokenName = this.get('currentTokenName');
this.deleteToken(tokenName);