Skip to content

Commit

Permalink
Trigger 404's
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreisnz committed Jan 11, 2017
1 parent 22ceb01 commit e0e431b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/components/user/user.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ module.exports = {
},

/**
* Find by username (doesn't trigger 404's)
* Find by username
*/
findByUsername(req, res, next) {

Expand All @@ -349,13 +349,14 @@ module.exports = {
User.findOne({username})
.then(user => {

//Found?
if (user) {
//No user?
if (!user) {
throw new NotFoundError();
}

//Check if suspended
if (user.isSuspended) {
throw new UserSuspendedError();
}
//Check if suspended
if (user.isSuspended) {
throw new UserSuspendedError();
}

//Set in request
Expand Down

0 comments on commit e0e431b

Please sign in to comment.