Commit b9526f1b38da0f885e6e9a8b9366b68b8a6f4b1a
1 parent
36eb7356
Overrides external user info for Noosfero and Twitter providers
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Showing
4 changed files
with
23 additions
and
4 deletions
Show diff stats
app/models/external_person.rb
plugins/oauth_client/controllers/public/oauth_client_plugin_public_controller.rb
... | ... | @@ -35,7 +35,7 @@ class OauthClientPluginPublicController < PublicController |
35 | 35 | identifier: auth.info.nickname || user.login, |
36 | 36 | name: auth.info.name, |
37 | 37 | created_at: Time.now, |
38 | - domain: auth.provider, | |
38 | + domain: provider.site || auth.provider, | |
39 | 39 | email: user.email) |
40 | 40 | person = ExternalPerson.get_or_create(webfinger) |
41 | 41 | user.external_person_id = person.id | ... | ... |
plugins/oauth_client/models/oauth_client_plugin/noosfero_oauth2_auth.rb
1 | 1 | class OauthClientPlugin::NoosferoOauth2Auth < OauthClientPlugin::Auth |
2 | 2 | |
3 | 3 | def image_url(size = nil) |
4 | - size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] | |
5 | - URI.join("http://#{self.external_person.source}/profile/#{self.external_person.identifier}/", size) | |
4 | + URI.join("http://#{self.provider.client_options[:site]}/profile/#{self.external_person.identifier}/icon/", size) | |
6 | 5 | end |
7 | 6 | |
8 | 7 | def profile_url | ... | ... |
plugins/oauth_client/models/oauth_client_plugin/twitter_auth.rb
1 | 1 | class OauthClientPlugin::TwitterAuth < OauthClientPlugin::Auth |
2 | 2 | |
3 | + IMAGE_SIZES = { | |
4 | + :big => "", | |
5 | + :thumb => "_bigger", | |
6 | + :portrait => "_normal", | |
7 | + :minor => "_normal", | |
8 | + :icon => "_mini" | |
9 | + } | |
10 | + | |
3 | 11 | def image_url(size = nil) |
4 | 12 | size = IMAGE_SIZES[size] || IMAGE_SIZES[:icon] |
5 | - self.external_person_image_url | |
13 | + self.external_person_image_url.gsub("_normal", size) | |
14 | + end | |
15 | + | |
16 | + def profile_url | |
17 | + "https://twitter.com/#{self.external_person.identifier}" | |
18 | + end | |
19 | + | |
20 | + def settings_url | |
21 | + "https://twitter.com/settings" | |
6 | 22 | end |
7 | 23 | end | ... | ... |