mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
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:
parent
513ed0834b
commit
b006eda9f0
2 changed files with 6 additions and 3 deletions
|
@ -37,7 +37,7 @@ export default Controller.extend(ValidationEngine, {
|
||||||
let credentials = this.getProperties('newPassword', 'ne2Password', 'token');
|
let credentials = this.getProperties('newPassword', 'ne2Password', 'token');
|
||||||
|
|
||||||
this.set('flowErrors', '');
|
this.set('flowErrors', '');
|
||||||
this.get('hasValidated').addObjects((['newPassword', 'ne2Password']));
|
this.get('hasValidated').addObjects(['newPassword', 'ne2Password']);
|
||||||
this.validate().then(() => {
|
this.validate().then(() => {
|
||||||
this.toggleProperty('submitting');
|
this.toggleProperty('submitting');
|
||||||
ajax({
|
ajax({
|
||||||
|
@ -54,7 +54,7 @@ export default Controller.extend(ValidationEngine, {
|
||||||
this.get('notifications').showAPIError(response, {key: 'password.reset'});
|
this.get('notifications').showAPIError(response, {key: 'password.reset'});
|
||||||
this.toggleProperty('submitting');
|
this.toggleProperty('submitting');
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch((error) => {
|
||||||
if (this.get('errors.newPassword')) {
|
if (this.get('errors.newPassword')) {
|
||||||
this.set('flowErrors', this.get('errors.newPassword')[0].message);
|
this.set('flowErrors', this.get('errors.newPassword')[0].message);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,10 @@ export default Controller.extend(ValidationEngine, {
|
||||||
if (this.get('errors.ne2Password')) {
|
if (this.get('errors.ne2Password')) {
|
||||||
this.set('flowErrors', this.get('errors.ne2Password')[0].message);
|
this.set('flowErrors', this.get('errors.ne2Password')[0].message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.get('errors.length') === 0) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ export default Route.extend(styleBody, {
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, params) {
|
setupController(controller, params) {
|
||||||
this._super(...arguments);
|
|
||||||
controller.token = params.token;
|
controller.token = params.token;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue