mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-23 00:00:02 +01:00

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
25 lines
613 B
JavaScript
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();
|
|
}
|
|
});
|