mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Trying to workaround a crash I saw in the logs for GitHub auth.
This commit is contained in:
parent
d7f8a212a4
commit
16e264788a
1 changed files with 4 additions and 1 deletions
|
@ -27,7 +27,10 @@ module.exports.setup = (app) ->
|
|||
request.get {uri: 'https://api.github.com/user', headers: headers}, (err, r, response) ->
|
||||
return log.error err if err?
|
||||
githubUser = JSON.parse response
|
||||
emailLower = githubUser.email.toLowerCase()
|
||||
log.info 'Got GitHub auth callback response', githubUser
|
||||
emailLower = githubUser.email?.toLowerCase()
|
||||
if not emailLower
|
||||
return errors.serverError res, "Problem finding GitHub user with that identity."
|
||||
|
||||
# GitHub users can change emails
|
||||
User.findOne {$or: [{emailLower: emailLower}, {githubID: githubUser.id}]}, (err, user) ->
|
||||
|
|
Loading…
Reference in a new issue