0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Merge pull request #3560 from felixrieseberg/iss3537

Descriptive error if user by mail not found.
This commit is contained in:
Sebastian Gierlinger 2014-08-02 13:13:54 +02:00
commit d35598457b
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'),