Fix password reset

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
This commit is contained in:
Kevin Ansfield 2015-12-15 21:51:36 +00:00
parent 513ed0834b
commit b006eda9f0
2 changed files with 6 additions and 3 deletions

View File

@ -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({
@ -54,7 +54,7 @@ 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);
}
@ -62,6 +62,10 @@ export default Controller.extend(ValidationEngine, {
if (this.get('errors.ne2Password')) {
this.set('flowErrors', this.get('errors.ne2Password')[0].message);
}
if (this.get('errors.length') === 0) {
throw error;
}
});
}
}

View File

@ -19,7 +19,6 @@ export default Route.extend(styleBody, {
},
setupController(controller, params) {
this._super(...arguments);
controller.token = params.token;
},