Merge pull request #10 from mrosack/master

download steam avatar
This commit is contained in:
Jonathan de Faye 2016-11-19 22:26:47 +00:00 committed by GitHub
commit 460bdf2ad9
1 changed files with 10 additions and 0 deletions

View File

@ -30,9 +30,19 @@ class SteamAuthenticator < ::Auth::Authenticator
result.name = data["name"] # unless profile privacy set to private result.name = data["name"] # unless profile privacy set to private
result.extra_data = { steam_uid: steam_uid } result.extra_data = { steam_uid: steam_uid }
retrieve_avatar(result.user, data["image"])
result result
end end
def retrieve_avatar(user, image_url)
return unless user
return unless image_url
return if user.user_avatar.try(:custom_upload_id).present?
Jobs.enqueue(:download_avatar_from_url, url: image_url, user_id: user.id, override_gravatar: true)
end
def after_create_account(user, auth) def after_create_account(user, auth)
data = auth[:extra_data] data = auth[:extra_data]
::PluginStore.set('steam', "steam_uid_#{data[:steam_uid]}", {user_id: user.id }) ::PluginStore.set('steam', "steam_uid_#{data[:steam_uid]}", {user_id: user.id })