mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Corrected sending errors in auth
This commit is contained in:
parent
a8353cb7ff
commit
a310afc750
1 changed files with 3 additions and 7 deletions
|
@ -159,15 +159,11 @@ module.exports.setup = (app) ->
|
|||
|
||||
module.exports.loginUser = loginUser = (req, res, user, send=true, next=null) ->
|
||||
user.save((err) ->
|
||||
if err
|
||||
return @sendDatabaseError(res, err)
|
||||
return errors.serverError res, err if err?
|
||||
|
||||
req.logIn(user, (err) ->
|
||||
if err
|
||||
return @sendDatabaseError(res, err)
|
||||
|
||||
if send
|
||||
return @sendSuccess(res, user)
|
||||
return errors.serverError res, err if err?
|
||||
return res.send user if send
|
||||
next() if next
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue