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'));
})
});
},
});

View file

@ -12,7 +12,7 @@ export default Ember.Controller.extend({
data: { email: this.get('email') },
};
ajaxRequest(url, options, this.get('session'));
this.transitionTo('login');
this.transitionToRoute('login');
this.get('flashMessages').information('Please check your email');
},

View file

@ -1,7 +1,7 @@
<div class="grid-1">
<div class="span-1">
<fieldset>
<legend>Account Lockout Access</legend>
<legend>Account Lockout/Password Reset</legend>
<form {{action 'save' on='submit'}}>
<ul>
<li>