devise_facebook_connectable 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/devise_facebook_connectable.rb +21 -8
- data/lib/devise_facebook_connectable/controller_filters.rb +3 -3
- data/lib/devise_facebook_connectable/model.rb +2 -0
- data/lib/devise_facebook_connectable/schema.rb +3 -3
- data/lib/devise_facebook_connectable/serializer.rb +1 -0
- data/lib/devise_facebook_connectable/strategy.rb +5 -4
- data/lib/devise_facebook_connectable/view_helpers.rb +1 -0
- metadata +2 -2
@@ -17,8 +17,8 @@ require 'devise_facebook_connectable/model'
|
|
17
17
|
require 'devise_facebook_connectable/serializer'
|
18
18
|
require 'devise_facebook_connectable/strategy'
|
19
19
|
require 'devise_facebook_connectable/schema'
|
20
|
-
require 'devise_facebook_connectable/controller_filters'
|
21
20
|
require 'devise_facebook_connectable/routes'
|
21
|
+
require 'devise_facebook_connectable/controller_filters'
|
22
22
|
require 'devise_facebook_connectable/view_helpers'
|
23
23
|
|
24
24
|
module Devise
|
@@ -48,13 +48,26 @@ I18n.load_path.unshift File.expand_path(File.join(File.dirname(__FILE__), *%w[de
|
|
48
48
|
#
|
49
49
|
Devise::STRATEGIES.unshift :facebook_connectable
|
50
50
|
Devise::SERIALIZERS.unshift :facebook_connectable
|
51
|
-
|
51
|
+
Devise::CONTROLLERS[:sessions].unshift :facebook_connectable
|
52
52
|
|
53
|
-
#
|
54
|
-
|
55
|
-
|
56
|
-
Devise
|
57
|
-
|
58
|
-
|
53
|
+
# PATCH:BEGIN: Very temporary one, while awaiting Devise 0.7.2.
|
54
|
+
Devise::Models.module_eval do
|
55
|
+
def devise(*modules)
|
56
|
+
raise "You need to give at least one Devise module" if modules.empty?
|
57
|
+
|
58
|
+
options = modules.extract_options!
|
59
|
+
modules = Devise.all if modules.include?(:all)
|
60
|
+
modules -= Array(options.delete(:except))
|
61
|
+
# PATCH: REMOVED: modules = Devise::ALL & modules
|
62
|
+
|
63
|
+
Devise.orm_class.included_modules_hook(self, modules) do
|
64
|
+
modules.each do |m|
|
65
|
+
devise_modules << m.to_sym
|
66
|
+
include Devise::Models.const_get(m.to_s.classify)
|
67
|
+
end
|
68
|
+
|
69
|
+
options.each { |key, value| send(:"#{key}=", value) }
|
70
|
+
end
|
59
71
|
end
|
60
72
|
end
|
73
|
+
# PATCH:END
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'facebooker'
|
2
|
+
require 'facebooker/session'
|
3
3
|
|
4
4
|
module Devise
|
5
5
|
module FacebookConnectable
|
6
6
|
module Controllers
|
7
7
|
module Filters
|
8
8
|
|
9
|
-
def self.included(
|
10
|
-
|
9
|
+
def self.included(base)
|
10
|
+
base.class_eval do
|
11
11
|
before_filter :expired_session_hack
|
12
12
|
before_filter :set_facebook_session
|
13
13
|
rescue_from ::Facebooker::Session::SessionExpired, :with => :facebook_session_expired
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require 'devise/schema'
|
2
3
|
require 'devise_facebook_connectable/model'
|
3
4
|
|
4
5
|
module Devise
|
@@ -8,9 +9,8 @@ module Devise
|
|
8
9
|
# Creates facebook_uid and facebook_session_key (for Facebook Connect authentication/management).
|
9
10
|
#
|
10
11
|
def facebook_connectable
|
11
|
-
apply_schema ::Devise.facebook_uid_field, Integer, :limit => 8
|
12
|
-
|
13
|
-
apply_schema ::Devise.facebook_session_key_field, String
|
12
|
+
apply_schema ::Devise.facebook_uid_field, Integer, :limit => 8 # BIGINT unsigned / 64-bit int
|
13
|
+
apply_schema ::Devise.facebook_session_key_field, String, :limit => 149 # [128][1][20] chars
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'devise/strategies/base'
|
3
|
+
require 'facebooker/session'
|
3
4
|
|
4
5
|
module Devise
|
5
|
-
module
|
6
|
+
module FacebookConnectable
|
6
7
|
|
7
8
|
# Default strategy for signing in a user using Facebook Connect (a Facebook account).
|
8
9
|
# Redirects to sign_in page if it's not authenticated
|
9
10
|
#
|
10
|
-
class
|
11
|
+
class Strategy < ::Warden::Strategies::Base
|
11
12
|
|
12
13
|
include ::Devise::Strategies::Base
|
13
14
|
|
@@ -59,4 +60,4 @@ module Devise
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
62
|
-
Warden::Strategies.add(:facebook_connectable, Devise::
|
63
|
+
Warden::Strategies.add(:facebook_connectable, Devise::FacebookConnectable::Strategy)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_facebook_connectable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Grimfelt
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-10 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|