Clean up password reset

This commit is contained in:
Matthew Dillon 2015-10-27 16:17:18 -07:00
parent 8e11942521
commit 1605f34dcc
7 changed files with 35 additions and 18 deletions

View file

@ -1,13 +1,19 @@
import Ember from 'ember';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
export default Ember.Route.extend({
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
session: Ember.inject.service('session'),
currentUser: Ember.inject.service('session-account'),
beforeModel: function(transition) {
this._super(transition);
let token = Ember.get(transition, 'queryParams.token');
this.get('session').authenticate('authenticator:jwt-resolved', token);
this.get('session').authenticate('authenticator:jwt-resolved', token).then(() => {
this.get('currentUser.account').then((account) => {
this.transitionTo('protected.users.changepassword', account.get('id'));
})
});
},
});