diff --git a/app/models/external_person.rb b/app/models/external_person.rb index 9984356..f87d5d2 100644 --- a/app/models/external_person.rb +++ b/app/models/external_person.rb @@ -122,6 +122,10 @@ class ExternalPerson < ActiveRecord::Base "#{jid(options)}/#{self.name}" end + def name + "#{self[:name]}@#{self.source}" + end + class ExternalPerson::Image def initialize(path) @path = path diff --git a/plugins/oauth_client/controllers/public/oauth_client_plugin_public_controller.rb b/plugins/oauth_client/controllers/public/oauth_client_plugin_public_controller.rb index 6f8665a..5c078d2 100644 --- a/plugins/oauth_client/controllers/public/oauth_client_plugin_public_controller.rb +++ b/plugins/oauth_client/controllers/public/oauth_client_plugin_public_controller.rb @@ -35,7 +35,7 @@ class OauthClientPluginPublicController < PublicController identifier: auth.info.nickname || user.login, name: auth.info.name, created_at: Time.now, - domain: auth.provider, + domain: provider.site || auth.provider, email: user.email) person = ExternalPerson.get_or_create(webfinger) user.external_person_id = person.id diff --git a/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb b/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb index cb468b8..84c2ccb 100644 --- a/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb +++ b/plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb @@ -1,8 +1,7 @@ class OauthClientPlugin::NoosferoOauth2Auth < OauthClientPlugin::Auth def image_url(size = nil) - size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] - URI.join("http://#{self.external_person.source}/profile/#{self.external_person.identifier}/", size) + URI.join("http://#{self.provider.client_options[:site]}/profile/#{self.external_person.identifier}/icon/", size) end def profile_url diff --git a/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb b/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb index ec3d47c..53a0acc 100644 --- a/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb +++ b/plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb @@ -1,7 +1,23 @@ class OauthClientPlugin::TwitterAuth < OauthClientPlugin::Auth + IMAGE_SIZES = { + :big => "", + :thumb => "_bigger", + :portrait => "_normal", + :minor => "_normal", + :icon => "_mini" + } + def image_url(size = nil) size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] - self.external_person_image_url + self.external_person_image_url.gsub("_normal", size) + end + + def profile_url + "https://twitter.com/#{self.external_person.identifier}" + end + + def settings_url + "https://twitter.com/settings" end end -- libgit2 0.21.2