fbdoorman 0.8.0.5 → 0.8.0.6
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/controllers/clearance/facebook_controller.rb +1 -1
- data/lib/facebook_helpers.rb +3 -3
- metadata +1 -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.6"
|
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}/**/*"]
|
@@ -8,7 +8,7 @@ class Clearance::FacebookController < ApplicationController
|
|
8
8
|
#The code arrives here
|
9
9
|
#Validate the token in the cookie
|
10
10
|
@fbcookie = parse_fb_cookie
|
11
|
-
if authenticated_fbu? then
|
11
|
+
if authenticated_fbu?(params[:token]) then
|
12
12
|
@user = find_fbuser(fbu.id) #The one from the DB
|
13
13
|
#If the user exists
|
14
14
|
if @user then
|
data/lib/facebook_helpers.rb
CHANGED
@@ -12,11 +12,11 @@ def user_from_fb?
|
|
12
12
|
end
|
13
13
|
|
14
14
|
#Si da false entonces el usuario se le deniega el acceso
|
15
|
-
def authenticated_fbu?
|
16
|
-
|
15
|
+
def authenticated_fbu?(token=nil)
|
16
|
+
if token.nil? then token = cookies[:fb_token] end
|
17
17
|
if @fbcookie.nil? then return false end
|
18
18
|
begin
|
19
|
-
@uid = MiniFB.rest(
|
19
|
+
@uid = MiniFB.rest(token, "users.getLoggedInUser", {})
|
20
20
|
if @uid.to_hash["response"] == current_user.fbid then return true else return false end
|
21
21
|
rescue MiniFB::FaceBookError #Is this error happen the token expired
|
22
22
|
return false
|