commit
460bdf2ad9
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.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 })
|
||||||
|
|
Loading…
Reference in New Issue