0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Descriptive error if user by mail not found.

closes #3537
- Replaced generic NotFound error with descriptive NotFoundError.
This commit is contained in:
Felix Rieseberg 2014-08-01 12:54:00 -07:00 committed by Felix Rieseberg
parent 653fe3fb44
commit abf251212c
2 changed files with 1 additions and 6 deletions

View file

@ -65,11 +65,6 @@ authentication = {
}).then(function () {
return when.resolve({passwordreset: [{message: 'Check your email for further instructions.'}]});
}).otherwise(function (error) {
// TODO: This is kind of sketchy, depends on magic string error.message from Bookshelf.
if (error && error.message === 'NotFound') {
error = new errors.UnauthorizedError('Invalid email address');
}
return when.reject(error);
});
});

View file

@ -631,7 +631,7 @@ User = ghostBookshelf.Model.extend({
generateResetToken: function (email, expires, dbHash) {
return this.getByEmail(email).then(function (foundUser) {
if (!foundUser) {
return when.reject(new Error('NotFound'));
return when.reject(new errors.NotFoundError('There is no user with that email address.'));
}
var hash = crypto.createHash('sha256'),