open-vault/ui/app/routes/vault/cluster/auth.js
Matthew Irish 4de7e4806b
UI unauthenticated auth method login (#4972)
* fix unauthenticated auth form
* make sure to redirect if you're already authed
* add the ability to build in a welcome message at build time
2018-07-20 16:48:25 -05:00

39 lines
889 B
JavaScript

import ClusterRouteBase from './cluster-route-base';
import Ember from 'ember';
import config from 'vault/config/environment';
const { RSVP, inject } = Ember;
export default ClusterRouteBase.extend({
flashMessages: inject.service(),
beforeModel() {
this.store.unloadAll('auth-method');
return this._super();
},
model() {
let cluster = this._super(...arguments);
return this.store
.findAll('auth-method', {
adapterOptions: {
unauthenticated: true,
},
})
.then(result => {
return RSVP.hash({
cluster,
methods: result,
});
});
},
resetController(controller) {
controller.set('wrappedToken', '');
controller.set('authMethod', '');
},
afterModel() {
if (config.welcomeMessage) {
this.get('flashMessages').stickyInfo(config.welcomeMessage);
}
},
});