fbdoorman 0.8.0.2 → 0.8.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/app/views/facebook/_fbjs.html.erb +28 -24
- data/lib/request_parser.rb +22 -0
- metadata +2 -1
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
gem.summary = "Rails authentication with facebook single sign-on OR email & password."
|
19
19
|
gem.description = "Painless user registration and sign-in using Facebook single sign-on with JS. Typical email login still works too."
|
20
20
|
gem.email = "pelaez89@gmail.com"
|
21
|
-
gem.version = "0.8.0.
|
21
|
+
gem.version = "0.8.0.4"
|
22
22
|
gem.homepage = "http://github.com/davidpelaez/minifb-clearance"
|
23
23
|
gem.authors = ["Fbdoorman: David Pelaez","MiniFB: Appoxy","Clearance: Thoughtbot"]
|
24
24
|
gem.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"]
|
@@ -1,31 +1,35 @@
|
|
1
1
|
<div id="fb-root"></div>
|
2
2
|
<script>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
xfbml : true // parse XFBML
|
10
|
-
});
|
3
|
+
window.fbAsyncInit = function() {
|
4
|
+
FB.init({ appId: '151745734845074',
|
5
|
+
status: true,
|
6
|
+
cookie: true,
|
7
|
+
xfbml: true,
|
8
|
+
oauth: true});
|
11
9
|
|
12
|
-
// Additional initialization code here
|
13
|
-
FB.Event.subscribe('auth.login', function(response) {
|
14
|
-
window.location="<%=FB_CALLBACK_URL%>";
|
15
|
-
});
|
16
|
-
|
17
|
-
FB.Event.subscribe('auth.logout', function(response) {
|
18
|
-
// The user has logged out, and the cookie has been cleared
|
19
|
-
window.location="<%=FB_CLOSED_URL%>";
|
20
|
-
});
|
21
10
|
|
11
|
+
function manageStatus(response) {
|
12
|
+
|
13
|
+
if (response.authResponse) {
|
14
|
+
//The user is logged in
|
15
|
+
alert("YOU'r Inside");
|
16
|
+
}else{
|
17
|
+
//The user is either not logged in or hasn't authorized the app
|
18
|
+
alert("You'r session's no longer valid");
|
19
|
+
}
|
22
20
|
};
|
23
21
|
|
24
|
-
//
|
25
|
-
(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
// run once with current status and whenever the status changes
|
23
|
+
FB.getLoginStatus(updateButton);
|
24
|
+
FB.Event.subscribe('auth.statusChange', updateButton);
|
25
|
+
};
|
26
|
+
|
27
|
+
//Load the FB JS SDK
|
28
|
+
(function() {
|
29
|
+
var e = document.createElement('script'); e.async = true;
|
30
|
+
e.src = document.location.protocol
|
31
|
+
+ '//connect.facebook.net/en_US/all.js';
|
32
|
+
document.getElementById('fb-root').appendChild(e);
|
33
|
+
}());
|
34
|
+
|
31
35
|
</script>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# FROM https://github.com/nsanta/fbgraph/blob/master/lib/fbgraph/canvas.rb
|
2
|
+
|
3
|
+
def parse_signed_request(request)
|
4
|
+
encoded_sig, payload = request.split('.', 2)
|
5
|
+
sig = urldecode64(encoded_sig)
|
6
|
+
data = JSON.parse(urldecode64(payload))
|
7
|
+
if data['algorithm'].to_s.upcase != 'HMAC-SHA256'
|
8
|
+
raise "Bad signature algorithm: %s" % data['algorithm']
|
9
|
+
end
|
10
|
+
expected_sig = OpenSSL::HMAC.digest('sha256', FB[:secret], payload)
|
11
|
+
if expected_sig != sig
|
12
|
+
raise "Bad signature"
|
13
|
+
end
|
14
|
+
data
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def urldecode64(str)
|
19
|
+
encoded_str = str.tr('-_', '+/')
|
20
|
+
encoded_str += '=' while !(encoded_str.size % 4).zero?
|
21
|
+
Base64.decode64(encoded_str)
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbdoorman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0.
|
4
|
+
version: 0.8.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/facebook_helpers.rb
|
64
64
|
- lib/fbdoorman.rb
|
65
65
|
- lib/mini_fb.rb
|
66
|
+
- lib/request_parser.rb
|
66
67
|
- rails/init.rb
|
67
68
|
homepage: http://github.com/davidpelaez/minifb-clearance
|
68
69
|
licenses: []
|