devise 1.2.rc → 1.2.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (101) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.rdoc +45 -1
  4. data/Gemfile +29 -0
  5. data/Gemfile.lock +158 -0
  6. data/MIT-LICENSE +1 -1
  7. data/README.rdoc +25 -8
  8. data/Rakefile +34 -0
  9. data/TODO +4 -0
  10. data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -3
  11. data/app/controllers/devise/registrations_controller.rb +4 -4
  12. data/app/controllers/devise/sessions_controller.rb +3 -2
  13. data/app/helpers/devise_helper.rb +6 -0
  14. data/config/locales/en.yml +2 -0
  15. data/devise.gemspec +25 -0
  16. data/lib/devise.rb +31 -5
  17. data/lib/devise/controllers/helpers.rb +30 -29
  18. data/lib/devise/controllers/internal_helpers.rb +6 -1
  19. data/lib/devise/controllers/rememberable.rb +52 -0
  20. data/lib/devise/encryptors/authlogic_sha512.rb +1 -1
  21. data/lib/devise/failure_app.rb +20 -4
  22. data/lib/devise/hooks/forgetable.rb +1 -4
  23. data/lib/devise/hooks/rememberable.rb +5 -44
  24. data/lib/devise/hooks/timeoutable.rb +1 -1
  25. data/lib/devise/models.rb +4 -2
  26. data/lib/devise/models/authenticatable.rb +13 -3
  27. data/lib/devise/models/confirmable.rb +3 -3
  28. data/lib/devise/models/database_authenticatable.rb +5 -3
  29. data/lib/devise/models/encryptable.rb +9 -2
  30. data/lib/devise/models/lockable.rb +18 -13
  31. data/lib/devise/models/recoverable.rb +9 -1
  32. data/lib/devise/models/registerable.rb +1 -1
  33. data/lib/devise/models/rememberable.rb +2 -5
  34. data/lib/devise/models/token_authenticatable.rb +4 -4
  35. data/lib/devise/omniauth.rb +3 -18
  36. data/lib/devise/omniauth/test_helpers.rb +14 -40
  37. data/lib/devise/omniauth/url_helpers.rb +6 -2
  38. data/lib/devise/rails.rb +3 -2
  39. data/lib/devise/rails/warden_compat.rb +5 -0
  40. data/lib/devise/schema.rb +3 -2
  41. data/lib/devise/strategies/authenticatable.rb +15 -1
  42. data/lib/devise/strategies/database_authenticatable.rb +1 -1
  43. data/lib/devise/strategies/rememberable.rb +6 -5
  44. data/lib/devise/strategies/token_authenticatable.rb +1 -1
  45. data/lib/devise/test_helpers.rb +3 -3
  46. data/lib/devise/version.rb +1 -1
  47. data/lib/generators/active_record/devise_generator.rb +2 -2
  48. data/lib/generators/active_record/templates/migration.rb +1 -0
  49. data/lib/generators/devise/devise_generator.rb +3 -1
  50. data/lib/generators/devise/orm_helpers.rb +1 -2
  51. data/lib/generators/devise/views_generator.rb +8 -45
  52. data/lib/generators/mongoid/devise_generator.rb +2 -2
  53. data/lib/generators/templates/devise.rb +19 -7
  54. data/test/controllers/helpers_test.rb +35 -5
  55. data/test/devise_test.rb +10 -0
  56. data/test/failure_app_test.rb +32 -3
  57. data/test/generators/active_record_generator_test.rb +24 -0
  58. data/test/generators/devise_generator_test.rb +33 -0
  59. data/test/generators/install_generator_test.rb +3 -4
  60. data/test/generators/mongoid_generator_test.rb +22 -0
  61. data/test/generators/views_generator_test.rb +13 -15
  62. data/test/indifferent_hash.rb +33 -0
  63. data/test/integration/authenticatable_test.rb +7 -0
  64. data/test/integration/omniauthable_test.rb +67 -32
  65. data/test/integration/registerable_test.rb +30 -0
  66. data/test/integration/rememberable_test.rb +16 -6
  67. data/test/integration/token_authenticatable_test.rb +43 -5
  68. data/test/models/confirmable_test.rb +20 -3
  69. data/test/models/encryptable_test.rb +1 -1
  70. data/test/models/lockable_test.rb +36 -15
  71. data/test/models/recoverable_test.rb +20 -11
  72. data/test/models/token_authenticatable_test.rb +19 -1
  73. data/test/models_test.rb +7 -0
  74. data/test/omniauth/test_helpers_test.rb +25 -0
  75. data/test/omniauth/url_helpers_test.rb +7 -0
  76. data/test/rails_app/Rakefile +10 -0
  77. data/test/rails_app/app/controllers/application_controller.rb +0 -1
  78. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +7 -0
  79. data/test/rails_app/app/views/admins/index.html.erb +1 -0
  80. data/test/rails_app/app/views/admins/sessions/new.html.erb +2 -0
  81. data/test/rails_app/app/views/home/index.html.erb +1 -0
  82. data/test/rails_app/app/views/home/private.html.erb +1 -0
  83. data/test/rails_app/app/views/layouts/application.html.erb +24 -0
  84. data/test/rails_app/app/views/users/index.html.erb +1 -0
  85. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +1 -0
  86. data/test/rails_app/app/views/users/sessions/new.html.erb +1 -0
  87. data/test/rails_app/config.ru +4 -0
  88. data/test/rails_app/config/application.rb +5 -0
  89. data/test/rails_app/config/database.yml +18 -0
  90. data/test/rails_app/config/initializers/devise.rb +18 -2
  91. data/test/rails_app/public/404.html +26 -0
  92. data/test/rails_app/public/422.html +26 -0
  93. data/test/rails_app/public/500.html +26 -0
  94. data/test/rails_app/public/favicon.ico +0 -0
  95. data/test/rails_app/script/rails +10 -0
  96. data/test/schema_test.rb +33 -0
  97. data/test/support/locale/en.yml +4 -0
  98. data/test/test_helper.rb +5 -2
  99. data/test/test_helpers_test.rb +33 -0
  100. metadata +71 -20
  101. data/test/generators/generators_test_helper.rb +0 -4
@@ -6,7 +6,7 @@
6
6
  Warden::Manager.after_set_user do |record, warden, options|
7
7
  scope = options[:scope]
8
8
 
9
- if record && record.respond_to?(:timedout?) && warden.authenticated?(scope)
9
+ if record && record.respond_to?(:timedout?) && warden.authenticated?(scope) && options[:store] != false
10
10
  last_request_at = warden.session(scope)['last_request_at']
11
11
 
12
12
  if record.timedout?(last_request_at)
@@ -2,7 +2,7 @@ module Devise
2
2
  module Models
3
3
  # Creates configuration values for Devise and for the given module.
4
4
  #
5
- # Devise::Models.config(Devise::Authenticable, :stretches, 10)
5
+ # Devise::Models.config(Devise::Authenticatable, :stretches, 10)
6
6
  #
7
7
  # The line above creates:
8
8
  #
@@ -47,7 +47,9 @@ module Devise
47
47
  def devise(*modules)
48
48
  include Devise::Models::Authenticatable
49
49
  options = modules.extract_options!
50
- self.devise_modules += Devise::ALL & modules.map(&:to_sym).uniq
50
+ self.devise_modules += modules.map(&:to_sym).uniq.sort_by { |s|
51
+ Devise::ALL.index(s) || -1 # follow Devise::ALL order
52
+ }
51
53
 
52
54
  devise_modules_hook! do
53
55
  devise_modules.each { |m| include Devise::Models.const_get(m.to_s.classify) }
@@ -2,7 +2,7 @@ require 'devise/hooks/activatable'
2
2
 
3
3
  module Devise
4
4
  module Models
5
- # Authenticable module. Holds common settings for authentication.
5
+ # Authenticatable module. Holds common settings for authentication.
6
6
  #
7
7
  # == Options
8
8
  #
@@ -26,7 +26,7 @@ module Devise
26
26
  #
27
27
  # == Active?
28
28
  #
29
- # Before authenticating an user and in each request, Devise checks if your model is active by
29
+ # Before authenticating a user and in each request, Devise checks if your model is active by
30
30
  # calling model.active?. This method is overwriten by other devise modules. For instance,
31
31
  # :confirmable overwrites .active? to only return true if your model was confirmed.
32
32
  #
@@ -100,6 +100,7 @@ module Devise
100
100
  # end
101
101
  #
102
102
  def find_for_authentication(conditions)
103
+ filter_auth_params(conditions)
103
104
  case_insensitive_keys.each { |k| conditions[k].try(:downcase!) }
104
105
  to_adapter.find_first(conditions)
105
106
  end
@@ -117,7 +118,7 @@ module Devise
117
118
  attributes.delete_if { |key, value| value.blank? }
118
119
 
119
120
  if attributes.size == required_attributes.size
120
- record = to_adapter.find_first(attributes)
121
+ record = to_adapter.find_first(filter_auth_params(attributes))
121
122
  end
122
123
 
123
124
  unless record
@@ -133,6 +134,15 @@ module Devise
133
134
  record
134
135
  end
135
136
 
137
+ protected
138
+
139
+ # Force keys to be string to avoid injection on mongoid related database.
140
+ def filter_auth_params(conditions)
141
+ conditions.each do |k, v|
142
+ conditions[k] = v.to_s
143
+ end
144
+ end
145
+
136
146
  # Generate a token by looping and ensuring does not already exist.
137
147
  def generate_token(column)
138
148
  loop do
@@ -56,7 +56,7 @@ module Devise
56
56
  end
57
57
 
58
58
  # Overwrites active? from Devise::Models::Activatable for confirmation
59
- # by verifying whether an user is active to sign in or not. If the user
59
+ # by verifying whether a user is active to sign in or not. If the user
60
60
  # is already confirmed, it should never be blocked. Otherwise we need to
61
61
  # calculate if the confirm time has not expired for this user.
62
62
  def active?
@@ -133,7 +133,7 @@ module Devise
133
133
  # with an email not found error.
134
134
  # Options must contain the user email
135
135
  def send_confirmation_instructions(attributes={})
136
- confirmable = find_or_initialize_with_error_by(:email, attributes[:email], :not_found)
136
+ confirmable = find_or_initialize_with_errors(confirmation_keys, attributes, :not_found)
137
137
  confirmable.resend_confirmation_token if confirmable.persisted?
138
138
  confirmable
139
139
  end
@@ -153,7 +153,7 @@ module Devise
153
153
  generate_token(:confirmation_token)
154
154
  end
155
155
 
156
- Devise::Models.config(self, :confirm_within)
156
+ Devise::Models.config(self, :confirm_within, :confirmation_keys)
157
157
  end
158
158
  end
159
159
  end
@@ -3,7 +3,7 @@ require 'bcrypt'
3
3
 
4
4
  module Devise
5
5
  module Models
6
- # Authenticable Module, responsible for encrypting password and validating
6
+ # Authenticatable Module, responsible for encrypting password and validating
7
7
  # authenticity of a user while signing in.
8
8
  #
9
9
  # == Options
@@ -31,9 +31,11 @@ module Devise
31
31
  self.encrypted_password = password_digest(@password) if @password.present?
32
32
  end
33
33
 
34
- # Verifies whether an incoming_password (ie from sign in) is the user password.
34
+ # Verifies whether an password (ie from sign in) is the user password.
35
35
  def valid_password?(password)
36
- ::BCrypt::Password.new(self.encrypted_password) == "#{password}#{self.class.pepper}"
36
+ bcrypt = ::BCrypt::Password.new(self.encrypted_password)
37
+ password = ::BCrypt::Engine.hash_secret("#{password}#{self.class.pepper}", bcrypt.salt)
38
+ Devise.secure_compare(password, self.encrypted_password)
37
39
  end
38
40
 
39
41
  # Set password and password confirmation to nil
@@ -36,7 +36,7 @@ module Devise
36
36
 
37
37
  # Verifies whether an incoming_password (ie from sign in) is the user password.
38
38
  def valid_password?(incoming_password)
39
- password_digest(incoming_password) == self.encrypted_password
39
+ Devise.secure_compare(password_digest(incoming_password), self.encrypted_password)
40
40
  end
41
41
 
42
42
  protected
@@ -53,7 +53,14 @@ module Devise
53
53
 
54
54
  # Returns the class for the configured encryptor.
55
55
  def encryptor_class
56
- @encryptor_class ||= ::Devise::Encryptors.const_get(encryptor.to_s.classify)
56
+ @encryptor_class ||= case encryptor
57
+ when :bcrypt
58
+ raise "In order to use bcrypt as encryptor, simply remove :encryptable from your devise model"
59
+ when nil
60
+ raise "You need to give an :encryptor as option in order to use :encryptable"
61
+ else
62
+ ::Devise::Encryptors.const_get(encryptor.to_s.classify)
63
+ end
57
64
  end
58
65
 
59
66
  def password_salt
@@ -15,13 +15,14 @@ module Devise
15
15
  # * +lock_strategy+: lock the user account by :failed_attempts or :none.
16
16
  # * +unlock_strategy+: unlock the user account by :time, :email, :both or :none.
17
17
  # * +unlock_in+: the time you want to lock the user after to lock happens. Only available when unlock_strategy is :time or :both.
18
+ # * +unlock_keys+: the keys you want to use when locking and unlocking an account
18
19
  #
19
20
  module Lockable
20
21
  extend ActiveSupport::Concern
21
22
 
22
23
  delegate :lock_strategy_enabled?, :unlock_strategy_enabled?, :to => "self.class"
23
24
 
24
- # Lock an user setting it's locked_at to actual time.
25
+ # Lock a user setting it's locked_at to actual time.
25
26
  def lock_access!
26
27
  self.locked_at = Time.now
27
28
 
@@ -33,14 +34,12 @@ module Devise
33
34
  save(:validate => false)
34
35
  end
35
36
 
36
- # Unlock an user by cleaning locket_at and failed_attempts.
37
+ # Unlock a user by cleaning locket_at and failed_attempts.
37
38
  def unlock_access!
38
- if_access_locked do
39
- self.locked_at = nil
40
- self.failed_attempts = 0 if respond_to?(:failed_attempts=)
41
- self.unlock_token = nil if respond_to?(:unlock_token=)
42
- save(:validate => false)
43
- end
39
+ self.locked_at = nil
40
+ self.failed_attempts = 0 if respond_to?(:failed_attempts=)
41
+ self.unlock_token = nil if respond_to?(:unlock_token=)
42
+ save(:validate => false)
44
43
  end
45
44
 
46
45
  # Verifies whether a user is locked or not.
@@ -59,7 +58,7 @@ module Devise
59
58
  end
60
59
 
61
60
  # Overwrites active? from Devise::Models::Activatable for locking purposes
62
- # by verifying whether an user is active to sign in or not based on locked?
61
+ # by verifying whether a user is active to sign in or not based on locked?
63
62
  def active?
64
63
  super && !access_locked?
65
64
  end
@@ -71,16 +70,21 @@ module Devise
71
70
  end
72
71
 
73
72
  # Overwrites valid_for_authentication? from Devise::Models::Authenticatable
74
- # for verifying whether an user is allowed to sign in or not. If the user
73
+ # for verifying whether a user is allowed to sign in or not. If the user
75
74
  # is locked, it should never be allowed.
76
75
  def valid_for_authentication?
77
76
  return super unless persisted? && lock_strategy_enabled?(:failed_attempts)
78
77
 
78
+ # Unlock the user if the lock is expired, no matter
79
+ # if the user can login or not (wrong password, etc)
80
+ unlock_access! if lock_expired?
81
+
79
82
  case (result = super)
80
83
  when Symbol
81
84
  return result
82
85
  when TrueClass
83
86
  self.failed_attempts = 0
87
+ save(:validate => false)
84
88
  when FalseClass
85
89
  # PostgreSQL uses nil as the default value for integer columns set to 0
86
90
  self.failed_attempts ||= 0
@@ -88,10 +92,11 @@ module Devise
88
92
  if attempts_exceeded?
89
93
  lock_access!
90
94
  return :locked
95
+ else
96
+ save(:validate => false)
91
97
  end
92
98
  end
93
99
 
94
- save(:validate => false) if changed?
95
100
  result
96
101
  end
97
102
 
@@ -132,7 +137,7 @@ module Devise
132
137
  # with an email not found error.
133
138
  # Options must contain the user email
134
139
  def send_unlock_instructions(attributes={})
135
- lockable = find_or_initialize_with_errors(authentication_keys, attributes, :not_found)
140
+ lockable = find_or_initialize_with_errors(unlock_keys, attributes, :not_found)
136
141
  lockable.resend_unlock_token if lockable.persisted?
137
142
  lockable
138
143
  end
@@ -161,7 +166,7 @@ module Devise
161
166
  Devise.friendly_token
162
167
  end
163
168
 
164
- Devise::Models.config(self, :maximum_attempts, :lock_strategy, :unlock_strategy, :unlock_in)
169
+ Devise::Models.config(self, :maximum_attempts, :lock_strategy, :unlock_strategy, :unlock_in, :unlock_keys)
165
170
  end
166
171
  end
167
172
  end
@@ -3,6 +3,12 @@ module Devise
3
3
 
4
4
  # Recoverable takes care of reseting the user password and send reset instructions.
5
5
  #
6
+ # ==Options
7
+ #
8
+ # Recoverable adds the following options to devise_for:
9
+ #
10
+ # * +reset_password_keys+: the keys you want to use when recovering the password for an account
11
+ #
6
12
  # == Examples
7
13
  #
8
14
  # # resets the user password and save the record, true if valid passwords are given, otherwise false
@@ -57,7 +63,7 @@ module Devise
57
63
  # with an email not found error.
58
64
  # Attributes must contain the user email
59
65
  def send_reset_password_instructions(attributes={})
60
- recoverable = find_or_initialize_with_errors(authentication_keys, attributes, :not_found)
66
+ recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)
61
67
  recoverable.send_reset_password_instructions if recoverable.persisted?
62
68
  recoverable
63
69
  end
@@ -77,6 +83,8 @@ module Devise
77
83
  recoverable.reset_password!(attributes[:password], attributes[:password_confirmation]) if recoverable.persisted?
78
84
  recoverable
79
85
  end
86
+
87
+ Devise::Models.config(self, :reset_password_keys)
80
88
  end
81
89
  end
82
90
  end
@@ -7,7 +7,7 @@ module Devise
7
7
 
8
8
  module ClassMethods
9
9
  # A convenience method that receives both parameters and session to
10
- # initialize an user. This can be used by OAuth, for example, to send
10
+ # initialize a user. This can be used by OAuth, for example, to send
11
11
  # in the user token and be stored on initialization.
12
12
  #
13
13
  # By default discards all information sent by the session by calling
@@ -44,10 +44,7 @@ module Devise
44
44
  module Rememberable
45
45
  extend ActiveSupport::Concern
46
46
 
47
- included do
48
- # Remember me option available in after_authentication hook.
49
- attr_accessor :remember_me
50
- end
47
+ attr_accessor :remember_me, :extend_remember_period
51
48
 
52
49
  # Generate a new remember token and save the record without validations
53
50
  # unless remember_across_browsers is true and the user already has a valid token.
@@ -60,7 +57,7 @@ module Devise
60
57
  # Removes the remember token only if it exists, and save the record
61
58
  # without validations.
62
59
  def forget_me!
63
- self.remember_token = nil if respond_to?(:remember_token)
60
+ self.remember_token = nil if respond_to?(:remember_token=)
64
61
  self.remember_created_at = nil
65
62
  save(:validate => false)
66
63
  end
@@ -20,7 +20,7 @@ module Devise
20
20
  #
21
21
  # == Options
22
22
  #
23
- # TokenAuthenticable adds the following options to devise_for:
23
+ # TokenAuthenticatable adds the following options to devise_for:
24
24
  #
25
25
  # * +token_authentication_key+: Defines name of the authentication token params key. E.g. /users/sign_in?some_key=...
26
26
  #
@@ -38,17 +38,17 @@ module Devise
38
38
  # Generate new authentication token and save the record.
39
39
  def reset_authentication_token!
40
40
  reset_authentication_token
41
- self.save(:validate => false)
41
+ save(:validate => false)
42
42
  end
43
43
 
44
44
  # Generate authentication token unless already exists.
45
45
  def ensure_authentication_token
46
- self.reset_authentication_token if self.authentication_token.blank?
46
+ reset_authentication_token if authentication_token.blank?
47
47
  end
48
48
 
49
49
  # Generate authentication token unless already exists and save the record.
50
50
  def ensure_authentication_token!
51
- self.reset_authentication_token! if self.authentication_token.blank?
51
+ reset_authentication_token! if authentication_token.blank?
52
52
  end
53
53
 
54
54
  # Hook called after token authentication.
@@ -5,29 +5,14 @@ rescue LoadError => e
5
5
  raise
6
6
  end
7
7
 
8
- module OmniAuth
9
- # TODO HAXES Backport to OmniAuth
10
- module Strategy #:nodoc:
11
- def initialize(app, name, *args)
12
- @app = app
13
- @name = name.to_sym
14
- @options = args.last.is_a?(Hash) ? args.pop : {}
15
- yield self if block_given?
16
- end
17
-
18
- def fail!(message_key, exception = nil)
19
- self.env['omniauth.error'] = exception
20
- self.env['omniauth.failure_key'] = message_key
21
- self.env['omniauth.failed_strategy'] = self
22
- OmniAuth.config.on_failure.call(self.env, message_key.to_sym)
23
- end
24
- end
8
+ unless OmniAuth.config.respond_to? :test_mode
9
+ raise "You are using an old OmniAuth version, please ensure you have 0.2.0.beta version or later installed."
25
10
  end
26
11
 
27
12
  # Clean up the default path_prefix. It will be automatically set by Devise.
28
13
  OmniAuth.config.path_prefix = nil
29
14
 
30
- OmniAuth.config.on_failure = Proc.new do |env, key|
15
+ OmniAuth.config.on_failure = Proc.new do |env|
31
16
  env['devise.mapping'] = Devise::Mapping.find_by_path!(env['PATH_INFO'], :path)
32
17
  controller_klass = "#{env['devise.mapping'].controllers[:omniauth_callbacks].camelize}Controller"
33
18
  controller_klass.constantize.action(:failure).call(env)
@@ -1,57 +1,31 @@
1
1
  module Devise
2
2
  module OmniAuth
3
3
  module TestHelpers
4
- def self.test_mode!
5
- Faraday.default_adapter = :test if defined?(Faraday)
6
- ActiveSupport.on_load(:action_controller) { include Devise::OmniAuth::TestHelpers }
7
- ActiveSupport.on_load(:action_view) { include Devise::OmniAuth::TestHelpers }
8
- end
4
+ DEPRECATION_MESSAGE = "Faraday changed the way mocks work in a way incompatible to Devise. Luckily, Omniauth now supports a new test mode, please use it in your tests instead: https://github.com/intridea/omniauth/wiki/Integration-Testing"
9
5
 
10
- def self.stub!(provider, stubs=nil, &block)
11
- raise "You either need to pass stubs as a block or as a parameter" unless block_given? || stubs
6
+ DeprecationError = Class.new(StandardError)
12
7
 
13
- config = Devise.omniauth_configs[provider]
14
- raise "Could not find configuration for #{provider.to_s} omniauth provider" unless config
15
-
16
- config.check_if_allow_stubs!
17
- stubs ||= Faraday::Adapter::Test::Stubs.new(&block)
8
+ def self.stub!(*args)
9
+ raise DeprecationError, DEPRECATION_MESSAGE
10
+ end
18
11
 
19
- config.build_connection do |b|
20
- b.adapter :test, stubs
21
- end
12
+ def self.reset_stubs!(*args)
13
+ raise DeprecationError, DEPRECATION_MESSAGE
22
14
  end
23
15
 
24
- def self.reset_stubs!(*providers)
25
- target = providers.any? ? Devise.omniauth_configs.slice(*providers) : Devise.omniauth_configs
26
- target.each_value do |config|
27
- next unless config.allow_stubs?
28
- config.build_connection { |b| b.adapter Faraday.default_adapter }
29
- end
16
+ def self.test_mode!
17
+ warn DEPRECATION_MESSAGE
30
18
  end
31
19
 
32
20
  def self.short_circuit_authorizers!
33
- module_eval <<-ALIASES, __FILE__, __LINE__ + 1
34
- def omniauth_authorize_path(*args)
35
- omniauth_callback_path(*args)
36
- end
37
- ALIASES
38
-
39
- Devise.mappings.each_value do |m|
40
- next unless m.omniauthable?
41
-
42
- module_eval <<-ALIASES, __FILE__, __LINE__ + 1
43
- def #{m.name}_omniauth_authorize_path(provider)
44
- #{m.name}_omniauth_callback_path(provider)
45
- end
46
- ALIASES
47
- end
21
+ ::OmniAuth.config.test_mode = true
22
+ warn DEPRECATION_MESSAGE
48
23
  end
49
24
 
50
25
  def self.unshort_circuit_authorizers!
51
- module_eval do
52
- instance_methods.each { |m| remove_method(m) }
53
- end
26
+ ::OmniAuth.config.test_mode = false
27
+ warn DEPRECATION_MESSAGE
54
28
  end
55
29
  end
56
30
  end
57
- end
31
+ end