1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-23 00:00:02 +01:00
VILLASweb/app/routes/application.js
Markus Grigull 6b8223df43 Fix user login/logout
Add logout route as buffer between logged-in state and login form
Fix setting current user in service
Fix message on invalid credentials in login form
Don't save the user password
2016-07-05 11:50:31 +02:00

25 lines
613 B
JavaScript

import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
const { service } = Ember.inject;
export default Ember.Route.extend(ApplicationRouteMixin, {
sessionUser: service('session-user'),
beforeModel() {
return this._loadCurrentUser();
},
sessionAuthenticated() {
this._loadCurrentUser().then(() => {
this.transitionTo('/');
}).catch(function(/* reason */) {
//console.log(reason);
this.get('session').invalidate();
});
},
_loadCurrentUser() {
return this.get('sessionUser').loadCurrentUser();
}
});