fbdoorman 0.8.0.5 → 0.8.0.6

Sign up to get free protection for your applications and to get access to all the features.
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.5"
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
@@ -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
- @fbcookie = parse_fb_cookie
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(@fbcookie["access_token"], "users.getLoggedInUser", {})
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
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.5
4
+ version: 0.8.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: