download steam avatar
This commit is contained in:
parent
491a3682a2
commit
50fd2ef5d8
10
plugin.rb
10
plugin.rb
|
@ -30,9 +30,19 @@ class SteamAuthenticator < ::Auth::Authenticator
|
|||
result.name = data["name"] # unless profile privacy set to private
|
||||
result.extra_data = { steam_uid: steam_uid }
|
||||
|
||||
retrieve_avatar(result.user, data["image"])
|
||||
|
||||
result
|
||||
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)
|
||||
data = auth[:extra_data]
|
||||
::PluginStore.set('steam', "steam_uid_#{data[:steam_uid]}", {user_id: user.id })
|
||||
|
|
Loading…
Reference in New Issue