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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79522f86bce86d9799bdcb6423874fa3c97ebe4d
4
- data.tar.gz: 345b7fddfccde780d47a4243cca4185e9cc56eb5
3
+ metadata.gz: 06ed02a023c4f08459f19e001b801464a1caa5aa
4
+ data.tar.gz: a391638c22279f189bc36990578b0831d1da2471
5
5
  SHA512:
6
- metadata.gz: 8034c10fd7ba604728cc7d420a7eafe2f1e403a871aacdded4b3f9dc4517053fe7ddfd342db52735101ae66fabfc84df29f556b2e8152fcd63ba552a3eba5e4e
7
- data.tar.gz: 66e6a2fb1cb1f939f11156ea92a0b40c5e90718b2e93a75d7948b700a41093dcabddaf7ef8ff040bb3efd30b4bd46fe0e4e0c3b913bcccd1ca06a5aafb002c23
6
+ metadata.gz: e1ddaa7384069b9bfb29976a4084f70c405ceee6e337951743868de1fd466a633762477b2e74e2d487503a65f2ce009d6b3465c86af7b29033d9f14dedd6ade9
7
+ data.tar.gz: e32035cd04f7ef0173842173e3a2be37f060f9e44a9c5bec6b4a1e23b12b738bd8f71c9472061389218ff9a796d604d037c5c6f45b165d9db586f77e82d2d97a
@@ -1,5 +1,11 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 4.0.2 - 2016-04-25
4
+
5
+ * bug fixes
6
+ * Fix strategy checking in `Lockable#unlock_strategy_enabled?` for `:none`
7
+ and `:undefined` strategies. (by @f3ndot)
8
+
3
9
  ### 4.0.1 - 2016-04-25
4
10
 
5
11
  * bug fixes
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise (4.0.1)
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.1.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
- [:both, strategy].include?(self.unlock_strategy)
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?
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "4.0.1".freeze
2
+ VERSION = "4.0.2".freeze
3
3
  end
@@ -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.1
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-04-25 00:00:00.000000000 Z
12
+ date: 2016-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden