open-vault/ui/app/routes/vault/cluster/auth.js
Matthew Irish 8d9d8e3d0e
UI wrapped token fix (#7398)
* default to token auth method

* pass in selectedValue to the AuthForm

* adjust when and if tasks are called so there's no race condition with wrapped_token query param

* add some tests for wrapped_token

* adjust redirect_to behavior so that it also works with the logout route and the wrapped_token query param

* fix linting
2019-10-01 15:30:56 -05:00

45 lines
1.1 KiB
JavaScript

import { inject as service } from '@ember/service';
import ClusterRouteBase from './cluster-route-base';
import config from 'vault/config/environment';
export default ClusterRouteBase.extend({
queryParams: {
authMethod: {
replace: true,
},
},
flashMessages: service(),
version: service(),
wizard: service(),
beforeModel() {
return this._super().then(() => {
return this.get('version').fetchFeatures();
});
},
model() {
return this._super(...arguments);
},
resetController(controller) {
controller.set('wrappedToken', '');
controller.set('authMethod', 'token');
},
afterModel() {
if (config.welcomeMessage) {
this.get('flashMessages').stickyInfo(config.welcomeMessage);
}
},
activate() {
this.get('wizard').set('initEvent', 'LOGIN');
this.get('wizard').transitionTutorialMachine(this.get('wizard.currentState'), 'TOLOGIN');
},
actions: {
willTransition(transition) {
if (transition.targetName !== this.routeName) {
this.get('wizard').transitionTutorialMachine(this.get('wizard.currentState'), 'INITDONE');
}
},
},
});