mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Merge pull request #3386 from felixrieseberg/iss3374
Signin: Proper notification if user not found
This commit is contained in:
commit
85f3c192dd
1 changed files with 6 additions and 3 deletions
|
@ -487,9 +487,12 @@ User = ghostBookshelf.Model.extend({
|
||||||
var self = this,
|
var self = this,
|
||||||
s;
|
s;
|
||||||
return this.getByEmail(object.email).then(function (user) {
|
return this.getByEmail(object.email).then(function (user) {
|
||||||
if (!user || user.get('status') === 'invited' || user.get('status') === 'invited-pending'
|
if (!user) {
|
||||||
|
return when.reject(new errors.NotFoundError('There is no user with that email address.'));
|
||||||
|
}
|
||||||
|
if (user.get('status') === 'invited' || user.get('status') === 'invited-pending'
|
||||||
|| user.get('status') === 'inactive') {
|
|| user.get('status') === 'inactive') {
|
||||||
return when.reject(new errors.NotFoundError('NotFound'));
|
return when.reject(new Error('The user with that email address is inactive.'));
|
||||||
}
|
}
|
||||||
if (user.get('status') !== 'locked') {
|
if (user.get('status') !== 'locked') {
|
||||||
return nodefn.call(bcrypt.compare, object.password, user.get('password')).then(function (matched) {
|
return nodefn.call(bcrypt.compare, object.password, user.get('password')).then(function (matched) {
|
||||||
|
@ -512,7 +515,7 @@ User = ghostBookshelf.Model.extend({
|
||||||
|
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
if (error.message === 'NotFound' || error.message === 'EmptyResponse') {
|
if (error.message === 'NotFound' || error.message === 'EmptyResponse') {
|
||||||
return when.reject(new Error('There is no user with that email address.'));
|
return when.reject(new errors.NotFoundError('There is no user with that email address.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return when.reject(error);
|
return when.reject(error);
|
||||||
|
|
Loading…
Reference in a new issue