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.
@@ -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
- # Devise::CONTROLLERS.unshift :facebook_connectable # TODO: Wait for Devise 0.7.2 release.
51
+ Devise::CONTROLLERS[:sessions].unshift :facebook_connectable
52
52
 
53
- # Override to get Devise to get that SessionsController should be used for both
54
- # :facebook_connectable and :authenticatable. Controller-logic is the same.
55
- #
56
- Devise::Mapping.class_eval do
57
- def allows?(controller)
58
- (self.for & [Devise::CONTROLLERS[controller.to_sym], :facebook_connectable].flatten).present?
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(klass)
10
- klass.class_eval do
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,6 @@
1
1
  # encoding: utf-8
2
+ require 'devise/models'
3
+ require 'facebooker/session'
2
4
  require 'devise_facebook_connectable/strategy'
3
5
  require 'devise_facebook_connectable/serializer'
4
6
 
@@ -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 # BIGINT unsigned / 64-bit int
12
- # apply_schema ::Devise.facebook_uid_field, String
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,3 +1,4 @@
1
1
  # encoding: utf-8
2
+ require 'devise/serializers/authenticatable'
2
3
 
3
4
  Warden::Serializers.add(:facebook_connectable, Devise::Serializers::Authenticatable)
@@ -1,13 +1,14 @@
1
1
  # encoding: utf-8
2
- require 'facebooker'
2
+ require 'devise/strategies/base'
3
+ require 'facebooker/session'
3
4
 
4
5
  module Devise
5
- module Strategies
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 FacebookConnectable < ::Warden::Strategies::Base
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::Strategies::FacebookConnectable)
63
+ Warden::Strategies.add(:facebook_connectable, Devise::FacebookConnectable::Strategy)
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require 'devise/mapping'
2
3
 
3
4
  module Devise
4
5
  module FacebookConnectable
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.2
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-09 00:00:00 +01:00
12
+ date: 2009-12-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency