devise 1.2.rc2 → 1.2.0
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.
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +0 -8
- data/app/controllers/devise/registrations_controller.rb +1 -1
- data/lib/devise.rb +16 -4
- data/lib/devise/hooks/activatable.rb +2 -2
- data/lib/devise/mapping.rb +6 -2
- data/lib/devise/models/authenticatable.rb +24 -12
- data/lib/devise/models/confirmable.rb +2 -2
- data/lib/devise/models/database_authenticatable.rb +1 -1
- data/lib/devise/models/lockable.rb +2 -2
- data/lib/devise/models/validatable.rb +1 -1
- data/lib/devise/omniauth/config.rb +0 -12
- data/lib/devise/rails.rb +15 -7
- data/lib/devise/rails/routes.rb +5 -2
- data/lib/devise/version.rb +1 -1
- data/test/integration/omniauthable_test.rb +16 -20
- data/test/models/confirmable_test.rb +9 -9
- data/test/models/lockable_test.rb +3 -3
- data/test/test_helpers_test.rb +2 -2
- metadata +9 -16
- data/TODO +0 -4
- data/lib/devise/omniauth/test_helpers.rb +0 -31
- data/test/omniauth/test_helpers_test.rb +0 -25
data/CHANGELOG.rdoc
CHANGED
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -212,14 +212,6 @@ Since Devise is an engine, all its views are packaged inside the gem. These view
|
|
212
212
|
|
213
213
|
rails generate devise:views
|
214
214
|
|
215
|
-
Devise currently supports generating views for the following template engines (use the `-e` flag for the devise:views generator):
|
216
|
-
|
217
|
-
* Erb
|
218
|
-
* Haml (http://github.com/nex3/haml)
|
219
|
-
* Slim (http://github.com/stonean/slim)
|
220
|
-
|
221
|
-
Note: If you are generating Haml or Slim templates, you will need to have a few dependencies such as `ruby_parser` (for Haml), `hpricot` (for both Haml and Slim) and `haml2slim` (for Slim) installed.
|
222
|
-
|
223
215
|
If you have more than one role in your application (such as "User" and "Admin"), you will notice that Devise uses the same views for all roles. Fortunately, Devise offers an easy way to customize views. All you need to do is set "config.scoped_views = true" inside "config/initializers/devise.rb".
|
224
216
|
|
225
217
|
After doing so, you will be able to have views based on the role like "users/sessions/new" and "admins/sessions/new". If no view is found within the scope, Devise will use the default view at "devise/sessions/new". You can also use the generator to generate scoped views:
|
@@ -14,7 +14,7 @@ class Devise::RegistrationsController < ApplicationController
|
|
14
14
|
build_resource
|
15
15
|
|
16
16
|
if resource.save
|
17
|
-
if resource.
|
17
|
+
if resource.active_for_authentication?
|
18
18
|
set_flash_message :notice, :signed_up
|
19
19
|
sign_in_and_redirect(resource_name, resource)
|
20
20
|
else
|
data/lib/devise.rb
CHANGED
@@ -70,9 +70,9 @@ module Devise
|
|
70
70
|
@@request_keys = []
|
71
71
|
|
72
72
|
# Keys that should be case-insensitive.
|
73
|
-
#
|
73
|
+
# False by default for backwards compatibility.
|
74
74
|
mattr_accessor :case_insensitive_keys
|
75
|
-
@@case_insensitive_keys =
|
75
|
+
@@case_insensitive_keys = false
|
76
76
|
|
77
77
|
# If http authentication is enabled by default.
|
78
78
|
mattr_accessor :http_authenticatable
|
@@ -226,6 +226,14 @@ module Devise
|
|
226
226
|
yield self
|
227
227
|
end
|
228
228
|
|
229
|
+
def self.ref(arg)
|
230
|
+
if defined?(ActiveSupport::Dependencies::ClassCache)
|
231
|
+
ActiveSupport::Dependencies::Reference.store(arg)
|
232
|
+
else
|
233
|
+
ActiveSupport::Dependencies.ref(arg)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
229
237
|
def self.omniauth_providers
|
230
238
|
omniauth_configs.keys
|
231
239
|
end
|
@@ -238,12 +246,16 @@ module Devise
|
|
238
246
|
|
239
247
|
# Get the mailer class from the mailer reference object.
|
240
248
|
def self.mailer
|
241
|
-
|
249
|
+
if defined?(ActiveSupport::Dependencies::ClassCache)
|
250
|
+
@@mailer_ref.get "Devise::Mailer"
|
251
|
+
else
|
252
|
+
@@mailer_ref.get
|
253
|
+
end
|
242
254
|
end
|
243
255
|
|
244
256
|
# Set the mailer reference object to access the mailer.
|
245
257
|
def self.mailer=(class_name)
|
246
|
-
@@mailer_ref =
|
258
|
+
@@mailer_ref = ref(class_name)
|
247
259
|
end
|
248
260
|
self.mailer = "Devise::Mailer"
|
249
261
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Deny user access whenever his account is not active yet. All strategies that inherits from
|
2
|
-
# Devise::Strategies::Authenticatable and uses the validate already check if the user is
|
2
|
+
# Devise::Strategies::Authenticatable and uses the validate already check if the user is active_for_authentication?
|
3
3
|
# before actively signing him in. However, we need this as hook to validate the user activity
|
4
4
|
# in each request and in case the user is using other strategies beside Devise ones.
|
5
5
|
Warden::Manager.after_set_user do |record, warden, options|
|
6
|
-
if record && record.respond_to?(:
|
6
|
+
if record && record.respond_to?(:active_for_authentication?) && !record.active_for_authentication?
|
7
7
|
scope = options[:scope]
|
8
8
|
warden.logout(scope)
|
9
9
|
throw :warden, :scope => scope, :message => record.inactive_message
|
data/lib/devise/mapping.rb
CHANGED
@@ -50,7 +50,7 @@ module Devise
|
|
50
50
|
@singular = (options[:singular] || @scoped_path.tr('/', '_').singularize).to_sym
|
51
51
|
|
52
52
|
@class_name = (options[:class_name] || name.to_s.classify).to_s
|
53
|
-
@ref =
|
53
|
+
@ref = Devise.ref(@class_name)
|
54
54
|
|
55
55
|
@path = (options[:path] || name).to_s
|
56
56
|
@path_prefix = options[:path_prefix]
|
@@ -73,7 +73,11 @@ module Devise
|
|
73
73
|
|
74
74
|
# Gives the class the mapping points to.
|
75
75
|
def to
|
76
|
-
|
76
|
+
if defined?(ActiveSupport::Dependencies::ClassCache)
|
77
|
+
@ref.get @class_name
|
78
|
+
else
|
79
|
+
@ref.get
|
80
|
+
end
|
77
81
|
end
|
78
82
|
|
79
83
|
def strategies
|
@@ -24,19 +24,19 @@ module Devise
|
|
24
24
|
# * +params_authenticatable+: if this model allows authentication through request params. By default true.
|
25
25
|
# It also accepts an array specifying the strategies that should allow params authentication.
|
26
26
|
#
|
27
|
-
# ==
|
27
|
+
# == active_for_authentication?
|
28
28
|
#
|
29
29
|
# Before authenticating a user and in each request, Devise checks if your model is active by
|
30
|
-
# calling model.
|
31
|
-
# :confirmable overwrites .
|
30
|
+
# calling model.active_for_authentication?. This method is overwriten by other devise modules. For instance,
|
31
|
+
# :confirmable overwrites .active_for_authentication? to only return true if your model was confirmed.
|
32
32
|
#
|
33
33
|
# You overwrite this method yourself, but if you do, don't forget to call super:
|
34
34
|
#
|
35
|
-
# def
|
35
|
+
# def active_for_authentication?
|
36
36
|
# super && special_condition_is_valid?
|
37
37
|
# end
|
38
38
|
#
|
39
|
-
# Whenever
|
39
|
+
# Whenever active_for_authentication? returns false, Devise asks the reason why your model is inactive using
|
40
40
|
# the inactive_message method. You can overwrite it as well:
|
41
41
|
#
|
42
42
|
# def inactive_message
|
@@ -55,10 +55,10 @@ module Devise
|
|
55
55
|
# find_for_authentication are the methods used in a Warden::Strategy to check
|
56
56
|
# if a model should be signed in or not.
|
57
57
|
#
|
58
|
-
# However, you should not overwrite this method, you should overwrite
|
59
|
-
# inactive_message instead.
|
58
|
+
# However, you should not overwrite this method, you should overwrite active_for_authentication?
|
59
|
+
# and inactive_message instead.
|
60
60
|
def valid_for_authentication?
|
61
|
-
if
|
61
|
+
if active_for_authentication?
|
62
62
|
block_given? ? yield : true
|
63
63
|
else
|
64
64
|
inactive_message
|
@@ -66,7 +66,19 @@ module Devise
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def active?
|
69
|
-
|
69
|
+
ActiveSupport::Deprecation.warn "[DEVISE] active? is deprecated, please use active_for_authentication? instead.", caller
|
70
|
+
active_for_authentication?
|
71
|
+
end
|
72
|
+
|
73
|
+
def active_for_authentication?
|
74
|
+
my_methods = self.class.instance_methods(false)
|
75
|
+
if my_methods.include?("active?") || my_methods.include?(:active?)
|
76
|
+
ActiveSupport::Deprecation.warn "[DEVISE] Overriding active? is deprecated to avoid conflicts. " \
|
77
|
+
"Please use active_for_authentication? instead.", caller
|
78
|
+
active?
|
79
|
+
else
|
80
|
+
true
|
81
|
+
end
|
70
82
|
end
|
71
83
|
|
72
84
|
def inactive_message
|
@@ -101,7 +113,7 @@ module Devise
|
|
101
113
|
#
|
102
114
|
def find_for_authentication(conditions)
|
103
115
|
filter_auth_params(conditions)
|
104
|
-
case_insensitive_keys.each { |k| conditions[k].try(:downcase!) }
|
116
|
+
(case_insensitive_keys || []).each { |k| conditions[k].try(:downcase!) }
|
105
117
|
to_adapter.find_first(conditions)
|
106
118
|
end
|
107
119
|
|
@@ -112,7 +124,7 @@ module Devise
|
|
112
124
|
|
113
125
|
# Find an initialize a group of attributes based on a list of required attributes.
|
114
126
|
def find_or_initialize_with_errors(required_attributes, attributes, error=:invalid) #:nodoc:
|
115
|
-
case_insensitive_keys.each { |k| attributes[k].try(:downcase!) }
|
127
|
+
(case_insensitive_keys || []).each { |k| attributes[k].try(:downcase!) }
|
116
128
|
|
117
129
|
attributes = attributes.slice(*required_attributes)
|
118
130
|
attributes.delete_if { |key, value| value.blank? }
|
@@ -140,7 +152,7 @@ module Devise
|
|
140
152
|
def filter_auth_params(conditions)
|
141
153
|
conditions.each do |k, v|
|
142
154
|
conditions[k] = v.to_s
|
143
|
-
end
|
155
|
+
end if conditions.is_a?(Hash)
|
144
156
|
end
|
145
157
|
|
146
158
|
# Generate a token by looping and ensuring does not already exist.
|
@@ -55,11 +55,11 @@ module Devise
|
|
55
55
|
unless_confirmed { send_confirmation_instructions }
|
56
56
|
end
|
57
57
|
|
58
|
-
# Overwrites
|
58
|
+
# Overwrites active_for_authentication? for confirmation
|
59
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
|
-
def
|
62
|
+
def active_for_authentication?
|
63
63
|
super && (!confirmation_required? || confirmed? || confirmation_period_valid?)
|
64
64
|
end
|
65
65
|
|
@@ -78,7 +78,7 @@ module Devise
|
|
78
78
|
|
79
79
|
# Downcase case-insensitive keys
|
80
80
|
def downcase_keys
|
81
|
-
self.class.case_insensitive_keys.each { |k| self[k].try(:downcase!) }
|
81
|
+
(self.class.case_insensitive_keys || []).each { |k| self[k].try(:downcase!) }
|
82
82
|
end
|
83
83
|
|
84
84
|
# Digests the password using bcrypt.
|
@@ -57,9 +57,9 @@ module Devise
|
|
57
57
|
if_access_locked { send_unlock_instructions }
|
58
58
|
end
|
59
59
|
|
60
|
-
# Overwrites
|
60
|
+
# Overwrites active_for_authentication? from Devise::Models::Activatable for locking purposes
|
61
61
|
# by verifying whether a user is active to sign in or not based on locked?
|
62
|
-
def
|
62
|
+
def active_for_authentication?
|
63
63
|
super && !access_locked?
|
64
64
|
end
|
65
65
|
|
@@ -24,7 +24,7 @@ module Devise
|
|
24
24
|
base.class_eval do
|
25
25
|
validates_presence_of :email, :if => :email_required?
|
26
26
|
validates_uniqueness_of :email, :scope => authentication_keys[1..-1],
|
27
|
-
:case_sensitive => case_insensitive_keys
|
27
|
+
:case_sensitive => (case_insensitive_keys != false), :allow_blank => true
|
28
28
|
validates_format_of :email, :with => email_regexp, :allow_blank => true
|
29
29
|
|
30
30
|
with_options :if => :password_required? do |v|
|
@@ -13,18 +13,6 @@ module Devise
|
|
13
13
|
def strategy_class
|
14
14
|
::OmniAuth::Strategies.const_get("#{::OmniAuth::Utils.camelize(@provider.to_s)}")
|
15
15
|
end
|
16
|
-
|
17
|
-
def check_if_allow_stubs!
|
18
|
-
raise "OmniAuth strategy for #{@provider} does not allow stubs, only OAuth2 ones do." unless allow_stubs?
|
19
|
-
end
|
20
|
-
|
21
|
-
def allow_stubs?
|
22
|
-
defined?(::OmniAuth::Strategies::OAuth2) && strategy.is_a?(::OmniAuth::Strategies::OAuth2)
|
23
|
-
end
|
24
|
-
|
25
|
-
def build_connection(&block)
|
26
|
-
strategy.client.connection.build(&block)
|
27
|
-
end
|
28
16
|
end
|
29
17
|
end
|
30
18
|
end
|
data/lib/devise/rails.rb
CHANGED
@@ -17,6 +17,14 @@ module Devise
|
|
17
17
|
Devise.include_helpers(Devise::Controllers)
|
18
18
|
end
|
19
19
|
|
20
|
+
initializer "devise.navigationals" do
|
21
|
+
formats = Devise.navigational_formats
|
22
|
+
if formats.include?(:"*/*") && formats.exclude?("*/*")
|
23
|
+
puts "[DEVISE] We see the symbol :\"*/*\" in the navigational formats in your initializer " \
|
24
|
+
"but not the string \"*/*\". Due to changes in latest Rails, please include the latter."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
20
28
|
initializer "devise.omniauth" do |app|
|
21
29
|
Devise.omniauth_configs.each do |provider, config|
|
22
30
|
app.middleware.use config.strategy_class, *config.args do |strategy|
|
@@ -32,17 +40,17 @@ module Devise
|
|
32
40
|
initializer "devise.encryptor_check" do
|
33
41
|
case Devise.encryptor
|
34
42
|
when :bcrypt
|
35
|
-
puts "[DEVISE] From version 1.2, there is no need to set your encryptor to bcrypt "
|
36
|
-
"since encryptors are only enabled if you include :encryptable in your models. "
|
37
|
-
"With this change, we can integrate better with bcrypt and get rid of the "
|
38
|
-
"password_salt column (since bcrypt stores the salt with password). "
|
43
|
+
puts "[DEVISE] From version 1.2, there is no need to set your encryptor to bcrypt " \
|
44
|
+
"since encryptors are only enabled if you include :encryptable in your models. " \
|
45
|
+
"With this change, we can integrate better with bcrypt and get rid of the " \
|
46
|
+
"password_salt column (since bcrypt stores the salt with password). " \
|
39
47
|
"Please comment config.encryptor in your initializer to get rid of this warning."
|
40
48
|
when nil
|
41
49
|
# Nothing to say
|
42
50
|
else
|
43
|
-
puts "[DEVISE] You are using #{Devise.encryptor} as encryptor. From version 1.2, "
|
44
|
-
"you need to explicitly add `devise :encryptable, :encryptor => :#{Devise.encryptor}` "
|
45
|
-
"to your models and comment the current value in the config/initializers/devise.rb. "
|
51
|
+
puts "[DEVISE] You are using #{Devise.encryptor} as encryptor. From version 1.2, " \
|
52
|
+
"you need to explicitly add `devise :encryptable, :encryptor => :#{Devise.encryptor}` " \
|
53
|
+
"to your models and comment the current value in the config/initializers/devise.rb. " \
|
46
54
|
"You must also add t.encryptable to your existing migrations."
|
47
55
|
end
|
48
56
|
end
|
data/lib/devise/rails/routes.rb
CHANGED
@@ -263,7 +263,8 @@ module ActionDispatch::Routing
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def devise_omniauth_callback(mapping, controllers) #:nodoc:
|
266
|
-
|
266
|
+
path, @scope[:path] = @scope[:path], nil
|
267
|
+
path_prefix = "/#{mapping.path}/auth".squeeze("/")
|
267
268
|
|
268
269
|
if ::OmniAuth.config.path_prefix && ::OmniAuth.config.path_prefix != path_prefix
|
269
270
|
warn "[DEVISE] You can only add :omniauthable behavior to one model."
|
@@ -271,8 +272,10 @@ module ActionDispatch::Routing
|
|
271
272
|
::OmniAuth.config.path_prefix = path_prefix
|
272
273
|
end
|
273
274
|
|
274
|
-
match "
|
275
|
+
match "#{path_prefix}/:action/callback", :action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)),
|
275
276
|
:to => controllers[:omniauth_callbacks], :as => :omniauth_callback
|
277
|
+
ensure
|
278
|
+
@scope[:path] = path
|
276
279
|
end
|
277
280
|
|
278
281
|
def with_devise_exclusive_scope(new_path, new_as) #:nodoc:
|
data/lib/devise/version.rb
CHANGED
@@ -119,24 +119,20 @@ class OmniauthableIntegrationTest < ActionController::IntegrationTest
|
|
119
119
|
assert_equal '/q/users/auth/facebook', current_url
|
120
120
|
end
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
# assert_current_url "/users/sign_in"
|
140
|
-
# assert_contain 'Could not authorize you from Facebook because "Invalid credentials".'
|
141
|
-
# end
|
122
|
+
test "handles callback error parameter according to the specification" do
|
123
|
+
OmniAuth.config.mock_auth[:facebook] = :access_denied
|
124
|
+
visit "/users/auth/facebook/callback?error=access_denied"
|
125
|
+
assert_current_url "/users/sign_in"
|
126
|
+
assert_contain 'Could not authorize you from Facebook because "Access denied".'
|
127
|
+
end
|
128
|
+
|
129
|
+
test "handles other exceptions from omniauth" do
|
130
|
+
OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
|
131
|
+
|
132
|
+
visit "/users/sign_in"
|
133
|
+
click_link "Sign in with facebook"
|
134
|
+
|
135
|
+
assert_current_url "/users/sign_in"
|
136
|
+
assert_contain 'Could not authorize you from Facebook because "Invalid credentials".'
|
137
|
+
end
|
142
138
|
end
|
@@ -167,10 +167,10 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|
167
167
|
swap Devise, :confirm_within => 1.day do
|
168
168
|
user = new_user
|
169
169
|
user.confirmation_sent_at = 2.days.ago
|
170
|
-
assert_not user.
|
170
|
+
assert_not user.active_for_authentication?
|
171
171
|
|
172
172
|
Devise.confirm_within = 3.days
|
173
|
-
assert user.
|
173
|
+
assert user.active_for_authentication?
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -180,35 +180,35 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|
180
180
|
user = create_user
|
181
181
|
|
182
182
|
user.confirmation_sent_at = 4.days.ago
|
183
|
-
assert user.
|
183
|
+
assert user.active_for_authentication?
|
184
184
|
|
185
185
|
user.confirmation_sent_at = 5.days.ago
|
186
|
-
assert_not user.
|
186
|
+
assert_not user.active_for_authentication?
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
190
|
test 'should be active when already confirmed' do
|
191
191
|
user = create_user
|
192
192
|
assert_not user.confirmed?
|
193
|
-
assert_not user.
|
193
|
+
assert_not user.active_for_authentication?
|
194
194
|
|
195
195
|
user.confirm!
|
196
196
|
assert user.confirmed?
|
197
|
-
assert user.
|
197
|
+
assert user.active_for_authentication?
|
198
198
|
end
|
199
199
|
|
200
200
|
test 'should not be active when confirm in is zero' do
|
201
201
|
Devise.confirm_within = 0.days
|
202
202
|
user = create_user
|
203
203
|
user.confirmation_sent_at = Date.today
|
204
|
-
assert_not user.
|
204
|
+
assert_not user.active_for_authentication?
|
205
205
|
end
|
206
206
|
|
207
207
|
test 'should not be active without confirmation' do
|
208
208
|
user = create_user
|
209
209
|
user.confirmation_sent_at = nil
|
210
210
|
user.save
|
211
|
-
assert_not user.reload.
|
211
|
+
assert_not user.reload.active_for_authentication?
|
212
212
|
end
|
213
213
|
|
214
214
|
test 'should be active without confirmation when confirmation is not required' do
|
@@ -216,7 +216,7 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|
216
216
|
user.instance_eval { def confirmation_required?; false end }
|
217
217
|
user.confirmation_sent_at = nil
|
218
218
|
user.save
|
219
|
-
assert user.reload.
|
219
|
+
assert user.reload.active_for_authentication?
|
220
220
|
end
|
221
221
|
|
222
222
|
test 'should find a user to send email instructions for the user confirm it\'s email by authentication_keys' do
|
@@ -47,12 +47,12 @@ class LockableTest < ActiveSupport::TestCase
|
|
47
47
|
assert user.access_locked?
|
48
48
|
end
|
49
49
|
|
50
|
-
test "
|
50
|
+
test "active_for_authentication? should be the opposite of locked?" do
|
51
51
|
user = create_user
|
52
52
|
user.confirm!
|
53
|
-
assert user.
|
53
|
+
assert user.active_for_authentication?
|
54
54
|
user.lock_access!
|
55
|
-
assert_not user.
|
55
|
+
assert_not user.active_for_authentication?
|
56
56
|
end
|
57
57
|
|
58
58
|
test "should unlock a user by cleaning locked_at, falied_attempts and unlock_token" do
|
data/test/test_helpers_test.rb
CHANGED
@@ -19,7 +19,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
19
19
|
test "redirects if attempting to access a page with an unconfirmed account" do
|
20
20
|
swap Devise, :confirm_within => 0 do
|
21
21
|
user = create_user
|
22
|
-
assert !user.
|
22
|
+
assert !user.active_for_authentication?
|
23
23
|
|
24
24
|
sign_in user
|
25
25
|
get :index
|
@@ -30,7 +30,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
30
30
|
test "returns nil if accessing current_user with an unconfirmed account" do
|
31
31
|
swap Devise, :confirm_within => 0 do
|
32
32
|
user = create_user
|
33
|
-
assert !user.
|
33
|
+
assert !user.active_for_authentication?
|
34
34
|
|
35
35
|
sign_in user
|
36
36
|
get :accept, :id => user
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 1.2.rc2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- "Jos\xC3\xA9 Valim"
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-25 00:00:00 +01:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
@@ -85,7 +84,6 @@ files:
|
|
85
84
|
- MIT-LICENSE
|
86
85
|
- README.rdoc
|
87
86
|
- Rakefile
|
88
|
-
- TODO
|
89
87
|
- app/controllers/devise/confirmations_controller.rb
|
90
88
|
- app/controllers/devise/omniauth_callbacks_controller.rb
|
91
89
|
- app/controllers/devise/passwords_controller.rb
|
@@ -143,7 +141,6 @@ files:
|
|
143
141
|
- lib/devise/modules.rb
|
144
142
|
- lib/devise/omniauth.rb
|
145
143
|
- lib/devise/omniauth/config.rb
|
146
|
-
- lib/devise/omniauth/test_helpers.rb
|
147
144
|
- lib/devise/omniauth/url_helpers.rb
|
148
145
|
- lib/devise/orm/active_record.rb
|
149
146
|
- lib/devise/orm/mongoid.rb
|
@@ -207,7 +204,6 @@ files:
|
|
207
204
|
- test/models/trackable_test.rb
|
208
205
|
- test/models/validatable_test.rb
|
209
206
|
- test/models_test.rb
|
210
|
-
- test/omniauth/test_helpers_test.rb
|
211
207
|
- test/omniauth/url_helpers_test.rb
|
212
208
|
- test/orm/active_record.rb
|
213
209
|
- test/orm/mongoid.rb
|
@@ -287,14 +283,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
284
|
none: false
|
289
285
|
requirements:
|
290
|
-
- - "
|
286
|
+
- - ">="
|
291
287
|
- !ruby/object:Gem::Version
|
292
|
-
hash:
|
288
|
+
hash: 3
|
293
289
|
segments:
|
294
|
-
-
|
295
|
-
|
296
|
-
- 1
|
297
|
-
version: 1.3.1
|
290
|
+
- 0
|
291
|
+
version: "0"
|
298
292
|
requirements: []
|
299
293
|
|
300
294
|
rubyforge_project: devise
|
@@ -342,7 +336,6 @@ test_files:
|
|
342
336
|
- test/models/trackable_test.rb
|
343
337
|
- test/models/validatable_test.rb
|
344
338
|
- test/models_test.rb
|
345
|
-
- test/omniauth/test_helpers_test.rb
|
346
339
|
- test/omniauth/url_helpers_test.rb
|
347
340
|
- test/orm/active_record.rb
|
348
341
|
- test/orm/mongoid.rb
|
data/TODO
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Devise
|
2
|
-
module OmniAuth
|
3
|
-
module TestHelpers
|
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"
|
5
|
-
|
6
|
-
DeprecationError = Class.new(StandardError)
|
7
|
-
|
8
|
-
def self.stub!(*args)
|
9
|
-
raise DeprecationError, DEPRECATION_MESSAGE
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.reset_stubs!(*args)
|
13
|
-
raise DeprecationError, DEPRECATION_MESSAGE
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.test_mode!
|
17
|
-
warn DEPRECATION_MESSAGE
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.short_circuit_authorizers!
|
21
|
-
::OmniAuth.config.test_mode = true
|
22
|
-
warn DEPRECATION_MESSAGE
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.unshort_circuit_authorizers!
|
26
|
-
::OmniAuth.config.test_mode = false
|
27
|
-
warn DEPRECATION_MESSAGE
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class OmniAuthTestHelpersTest < ActiveSupport::TestCase
|
4
|
-
test "Assert that stub! raises deprecation error" do
|
5
|
-
assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do
|
6
|
-
Devise::OmniAuth::TestHelpers.stub!
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
test "Assert that reset_stubs! raises deprecation error" do
|
11
|
-
assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do
|
12
|
-
Devise::OmniAuth::TestHelpers.reset_stubs!
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
test "Assert that short_circuit_authorizers! warns about deprecation" do
|
17
|
-
Devise::OmniAuth::TestHelpers.short_circuit_authorizers!
|
18
|
-
assert ::OmniAuth.config.test_mode
|
19
|
-
end
|
20
|
-
|
21
|
-
test "Assert that unshort_circuit_authorizers! warns about deprecation" do
|
22
|
-
Devise::OmniAuth::TestHelpers.unshort_circuit_authorizers!
|
23
|
-
assert ! ::OmniAuth.config.test_mode
|
24
|
-
end
|
25
|
-
end
|