plataforma_social 0.0.33 → 0.0.34
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/plataforma_social/facebook.rb +24 -7
- data/lib/plataforma_social/version.rb +1 -1
- metadata +1 -1
@@ -21,12 +21,27 @@ module PlataformaSocial
|
|
21
21
|
|
22
22
|
if parse_facebook_signed_request && parse_facebook_signed_request['oauth_token']
|
23
23
|
if parse_facebook_signed_request['expires'] > Time.now.to_i # Se o access_token do usuário não estiver expirado
|
24
|
-
if !session[:not_verify_facebook_permissions]
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
if !session[:not_verify_facebook_permissions] == true
|
25
|
+
begin
|
26
|
+
permissions = @graph.get_object('me', :fields => 'permissions')['permissions']['data'][0]
|
27
|
+
session[:not_verify_facebook_permissions] = true
|
28
|
+
|
29
|
+
PlataformaSocial.facebook_scope.split(',').each do |permission|
|
30
|
+
redirect = true unless permissions[permission.strip]
|
31
|
+
end
|
32
|
+
rescue Koala::Facebook::AuthenticationError
|
33
|
+
redirect = true
|
34
|
+
|
35
|
+
# Remove o signed_request da URL já que ele está expirado e recarrega o objeto do @oauth
|
36
|
+
if params[:callback_url].present?
|
37
|
+
params[:callback_url].gsub!("signed_request=#{params[:signed_request]}", "")
|
38
|
+
elsif request.present?
|
39
|
+
request.fullpath.gsub!("signed_request=#{params[:signed_request]}", "")
|
40
|
+
else
|
41
|
+
PlataformaSocial.facebook_callback_url.to_s.gsub!("signed_request=#{params[:signed_request]}", "")
|
42
|
+
end
|
43
|
+
|
44
|
+
load_oauth
|
30
45
|
end
|
31
46
|
end
|
32
47
|
else
|
@@ -108,9 +123,11 @@ module PlataformaSocial
|
|
108
123
|
uri.query,
|
109
124
|
"gm_referral_code=#{URI.encode(params[:gm_referral_code] || '')}",
|
110
125
|
"utm_source=#{URI.encode(params[:utm_source] || '')}",
|
126
|
+
"source=#{URI.encode(params[:utm_source] || '')}",
|
111
127
|
"campaign=#{URI.encode(params[:utm_campaign] || '')}",
|
128
|
+
"utm_campaign=#{URI.encode(params[:utm_campaign] || '')}",
|
112
129
|
"medium=#{URI.encode(params[:utm_medium] || '')}",
|
113
|
-
"
|
130
|
+
"utm_medium=#{URI.encode(params[:utm_medium] || '')}"
|
114
131
|
].compact.join('&')
|
115
132
|
|
116
133
|
uri.to_s
|