mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
208005f9c9
Changes to functionality - Removed syncing of user metadata including gender, location etc. These are no longer available to standard Facebook applications. - Removed the remote 'revoke' functionality. No other providers have it, and it does not appear to be standard practice in other apps. - The 'facebook_no_email' event is no longer logged. The system can cope fine with a missing email address. Data is migrated to the new user_associated_accounts table. facebook_user_infos can be dropped once we are confident the data has been migrated successfully.
27 lines
765 B
Ruby
27 lines
765 B
Ruby
class Auth::FacebookAuthenticator < Auth::ManagedAuthenticator
|
|
|
|
AVATAR_SIZE ||= 480
|
|
|
|
def name
|
|
"facebook"
|
|
end
|
|
|
|
def enabled?
|
|
SiteSetting.enable_facebook_logins
|
|
end
|
|
|
|
def register_middleware(omniauth)
|
|
omniauth.provider :facebook,
|
|
setup: lambda { |env|
|
|
strategy = env["omniauth.strategy"]
|
|
strategy.options[:client_id] = SiteSetting.facebook_app_id
|
|
strategy.options[:client_secret] = SiteSetting.facebook_app_secret
|
|
strategy.options[:info_fields] = 'name,first_name,last_name,email'
|
|
strategy.options[:image_size] = { width: AVATAR_SIZE, height: AVATAR_SIZE }
|
|
strategy.options[:secure_image_url] = true
|
|
},
|
|
scope: "email"
|
|
end
|
|
|
|
end
|