devise 4.0.1 → 4.0.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/lib/devise/models/lockable.rb +5 -1
- data/lib/devise/version.rb +1 -1
- data/test/models/lockable_test.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06ed02a023c4f08459f19e001b801464a1caa5aa
|
4
|
+
data.tar.gz: a391638c22279f189bc36990578b0831d1da2471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ddaa7384069b9bfb29976a4084f70c405ceee6e337951743868de1fd466a633762477b2e74e2d487503a65f2ce009d6b3465c86af7b29033d9f14dedd6ade9
|
7
|
+
data.tar.gz: e32035cd04f7ef0173842173e3a2be37f060f9e44a9c5bec6b4a1e23b12b738bd8f71c9472061389218ff9a796d604d037c5c6f45b165d9db586f77e82d2d97a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
devise (4.0.
|
4
|
+
devise (4.0.2)
|
5
5
|
bcrypt (~> 3.0)
|
6
6
|
orm_adapter (~> 0.1)
|
7
7
|
railties (>= 4.1.0, < 5.1)
|
@@ -134,7 +134,7 @@ GEM
|
|
134
134
|
rake (11.0.1)
|
135
135
|
rdoc (4.2.2)
|
136
136
|
json (~> 1.4)
|
137
|
-
responders (2.
|
137
|
+
responders (2.2.0)
|
138
138
|
railties (>= 4.2.0, < 5.1)
|
139
139
|
ruby-openid (2.7.0)
|
140
140
|
sprockets (3.5.2)
|
@@ -155,6 +155,9 @@ module Devise
|
|
155
155
|
end
|
156
156
|
|
157
157
|
module ClassMethods
|
158
|
+
# List of strategies that are enabled/supported if :both is used.
|
159
|
+
BOTH_STRATEGIES = [:time, :email]
|
160
|
+
|
158
161
|
# Attempt to find a user by its unlock keys. If a record is found, send new
|
159
162
|
# unlock instructions to it. If not user is found, returns a new user
|
160
163
|
# with an email not found error.
|
@@ -181,7 +184,8 @@ module Devise
|
|
181
184
|
|
182
185
|
# Is the unlock enabled for the given unlock strategy?
|
183
186
|
def unlock_strategy_enabled?(strategy)
|
184
|
-
|
187
|
+
self.unlock_strategy == strategy ||
|
188
|
+
(self.unlock_strategy == :both && BOTH_STRATEGIES.include?(strategy))
|
185
189
|
end
|
186
190
|
|
187
191
|
# Is the lock enabled for the given lock strategy?
|
data/lib/devise/version.rb
CHANGED
@@ -325,4 +325,26 @@ class LockableTest < ActiveSupport::TestCase
|
|
325
325
|
user.lock_access!
|
326
326
|
assert_equal :locked, user.unauthenticated_message
|
327
327
|
end
|
328
|
+
|
329
|
+
test 'unlock_strategy_enabled? should return true for both, email, and time strategies if :both is used' do
|
330
|
+
swap Devise, unlock_strategy: :both do
|
331
|
+
user = create_user
|
332
|
+
assert_equal true, user.unlock_strategy_enabled?(:both)
|
333
|
+
assert_equal true, user.unlock_strategy_enabled?(:time)
|
334
|
+
assert_equal true, user.unlock_strategy_enabled?(:email)
|
335
|
+
assert_equal false, user.unlock_strategy_enabled?(:none)
|
336
|
+
assert_equal false, user.unlock_strategy_enabled?(:an_undefined_strategy)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
test 'unlock_strategy_enabled? should return true only for the configured strategy' do
|
341
|
+
swap Devise, unlock_strategy: :email do
|
342
|
+
user = create_user
|
343
|
+
assert_equal false, user.unlock_strategy_enabled?(:both)
|
344
|
+
assert_equal false, user.unlock_strategy_enabled?(:time)
|
345
|
+
assert_equal true, user.unlock_strategy_enabled?(:email)
|
346
|
+
assert_equal false, user.unlock_strategy_enabled?(:none)
|
347
|
+
assert_equal false, user.unlock_strategy_enabled?(:an_undefined_strategy)
|
348
|
+
end
|
349
|
+
end
|
328
350
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|