BUGFIX: allow facebook auth for people refusing email

This commit is contained in:
Sam 2014-02-17 14:45:17 +11:00
parent abb2de22ab
commit 70c50d321a

View file

@ -13,14 +13,14 @@ class Auth::FacebookAuthenticator < Auth::Authenticator
result.email = email = session_info[:email]
result.email_valid = true
result.name = name = facebook_hash[:name]
result.name = facebook_hash[:name]
result.extra_data = facebook_hash
user_info = FacebookUserInfo.where(facebook_user_id: facebook_hash[:facebook_user_id]).first
result.user = user_info.try(:user)
if !result.user && result.user = User.where(email: Email.downcase(email)).first
if !result.user && !email.blank? && result.user = User.where(email: Email.downcase(email)).first
FacebookUserInfo.create({user_id: result.user.id}.merge(facebook_hash))
end