       myHostname: env.hostname
       appId: env.facebook_app_id
       appSecret: env.secrets.facebook
+      findOrCreateUser: (session, accessTok, accessTokExtra, fb) ->
+        promise = @Promise()
+        Person.findOrCreateFromFacebook fb, (err, person) ->
+          return promise.fail err if err
+          promise.fulfill person
+        promise
 
 ROLES.forEach (t) ->
   PersonSchema.virtual(t).get -> @role == t

  @image_url ||= twitter.profileImageUrl.replace('_normal.', '.')
  @role ||= 'nomination'

PersonSchema.static 'findOrCreateFromTwitter', (twitter, callback) ->
  Person.findOne
    $or: [

      try person.updateFromTwitter twitter catch e then callback(e)
      person.save (err) -> callback(err, person)

PersonSchema.static 'findOrCreateFromFacebook', (facebook, callback) ->
  console.log arguments.magenta
  Person.findOne
    $or: [
      { facebook_name: facebook.alias }
      { 'fb.id': facebook.id }]
    (error, person) ->
      return callback(error) if error
      person ||= new Person
      try person.updateFromFacebook facebook catch e then callback(e)
      person.save (err) -> callback(err, person)

Person = mongoose.model 'Person', PersonSchema
Person.ROLES = ROLES
