Skip to content

Commit

Permalink
try id = user && !_.isEmpty(user.get()) && user.get()[0].id , see #7
Browse files Browse the repository at this point in the history
Conflicts:
	lib/server/auth.js
	src/server/auth.coffee
  • Loading branch information
lefnire committed Oct 18, 2012
1 parent 79fd3f0 commit d504cbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/server/auth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/server/auth.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
derby = require('derby')
schema = require('../app/schema')
content = require('../app/content')
_ = require('lodash')

# Need this for later use by EveryAuth in the MiddleWare
req = undefined
Expand Down Expand Up @@ -49,7 +50,7 @@ module.exports.setupEveryauth = (everyauth) ->
model = req.getModel()
q = model.query('users').withEveryauth('facebook', fbUserMetadata.id)
model.fetch q, (err, user) ->
id = user && user.get().length>0 && user.get()[0].id
id = user && !_.isEmpty(user.get()) && user.get()[0].id
console.log {err:err, id:id, fbUserMetadata:fbUserMetadata}
# Has user been tied to facebook account already?
if (id && id!=session.userId)
Expand Down

0 comments on commit d504cbe

Please sign in to comment.