Skip to content

Commit

Permalink
Fix password reset
Browse files Browse the repository at this point in the history
closes #6229
- removes `_super` call in the reset route's `setupController` hook to avoid a `model` property being set which was being picked up by the validation engine
- throw the error if we fail in the password reset process from something we aren't expecting
  • Loading branch information
kevinansfield committed Dec 15, 2015
1 parent 5184d6b commit b928366
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/client/app/controllers/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default Controller.extend(ValidationEngine, {
let credentials = this.getProperties('newPassword', 'ne2Password', 'token');

this.set('flowErrors', '');
this.get('hasValidated').addObjects((['newPassword', 'ne2Password']));
this.get('hasValidated').addObjects(['newPassword', 'ne2Password']);
this.validate().then(() => {
this.toggleProperty('submitting');
ajax({
Expand All @@ -54,14 +54,18 @@ export default Controller.extend(ValidationEngine, {
this.get('notifications').showAPIError(response, {key: 'password.reset'});
this.toggleProperty('submitting');
});
}).catch(() => {
}).catch((error) => {
if (this.get('errors.newPassword')) {
this.set('flowErrors', this.get('errors.newPassword')[0].message);
}

if (this.get('errors.ne2Password')) {
this.set('flowErrors', this.get('errors.ne2Password')[0].message);
}

if (this.get('errors.length') === 0) {
throw error;
}
});
}
}
Expand Down
1 change: 0 additions & 1 deletion core/client/app/routes/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default Route.extend(styleBody, {
},

setupController(controller, params) {
this._super(...arguments);
controller.token = params.token;
},

Expand Down

0 comments on commit b928366

Please sign in to comment.