devise 4.0.0.rc2 → 4.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +20 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +4 -2
- data/gemfiles/Gemfile.rails-5.0-beta.lock +9 -7
- data/lib/devise.rb +92 -6
- data/lib/devise/controllers/helpers.rb +0 -6
- data/lib/devise/models/confirmable.rb +1 -1
- data/lib/devise/models/rememberable.rb +6 -7
- data/lib/devise/parameter_sanitizer.rb +1 -1
- data/lib/devise/strategies/rememberable.rb +3 -6
- data/lib/devise/version.rb +1 -1
- data/lib/generators/devise/orm_helpers.rb +1 -1
- data/lib/generators/templates/devise.rb +2 -2
- data/test/devise_test.rb +27 -0
- data/test/integration/rememberable_test.rb +34 -1
- data/test/rails_app/app/active_record/user.rb +0 -2
- data/test/rails_app/config/boot.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693c6038f27cc54c1fe16fd9cd36248963838e5d
|
4
|
+
data.tar.gz: ac7de821309c5c7e7b945e1fbda81cd7a2dcc06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce83c62cbeeb436413cde1df89d40eb95c27739f4536c295fa946df980f5c5775c7e6e50c06d29f2d047f9a4a4a78d8fca2fe93f100806eeca2c1c05eb24a584
|
7
|
+
data.tar.gz: 29e5e431d5dfde54ebdcbd6f80f357161648bb2a51a1492e98560646c24d9cac5ee427089d4ff995698e61aa553510d303a64391b58e9492f64b3cb76c9dec75
|
data/.travis.yml
CHANGED
@@ -3,7 +3,7 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 2.3.0
|
5
5
|
- 2.2.4
|
6
|
-
- 2.1.
|
6
|
+
- 2.1.8
|
7
7
|
|
8
8
|
gemfile:
|
9
9
|
- Gemfile
|
@@ -13,7 +13,7 @@ gemfile:
|
|
13
13
|
|
14
14
|
matrix:
|
15
15
|
exclude:
|
16
|
-
- rvm: 2.1.
|
16
|
+
- rvm: 2.1.8
|
17
17
|
gemfile: gemfiles/Gemfile.rails-5.0-beta
|
18
18
|
- env: DEVISE_ORM=mongoid
|
19
19
|
gemfile: gemfiles/Gemfile.rails-5.0-beta
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
### Unreleased
|
2
2
|
|
3
|
+
### 4.0.0 - 2016-04-18
|
4
|
+
|
5
|
+
* bug fixes
|
6
|
+
* Fix the `extend_remember_period` configuration. When set to `false` it does
|
7
|
+
not update the cookie expiration anymore.(by @ulissesalmeida)
|
8
|
+
|
9
|
+
* deprecations
|
10
|
+
* Added a warning of default value change in Devise 4.1 for users that uses
|
11
|
+
the the default configuration of the following configurations: (by @ulissesalmeida)
|
12
|
+
* `strip_whitespace_keys` - The default will be `[:email]`.
|
13
|
+
* `skip_session_storage` - The default will be `[:http_auth]`.
|
14
|
+
* `sign_out_via` - The default will be `:delete`.
|
15
|
+
* `reconfirmable` - The default will be `true`.
|
16
|
+
* `email_regexp` - The default will be `/\A[^@\s]+@[^@\s]+\z/`.
|
17
|
+
* Removed deprecated argument of `Devise::Models::Rememberable#remember_me!` (by @ulissesalmeida)
|
18
|
+
* Removed deprecated private method Devise::Controllers::Helpers#expire_session_data_after_sign_in!
|
19
|
+
(by @bogdanvlviv)
|
20
|
+
|
21
|
+
### 4.0.0.rc2 - 2016-03-09
|
22
|
+
|
3
23
|
* enhancements
|
4
24
|
* Introduced `DeviseController#set_flash_message!` for conditional flash
|
5
25
|
messages setting to reduce complexity.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
devise (4.0.0
|
4
|
+
devise (4.0.0)
|
5
5
|
bcrypt (~> 3.0)
|
6
6
|
orm_adapter (~> 0.1)
|
7
7
|
railties (>= 4.1.0, < 5.1)
|
@@ -138,7 +138,7 @@ GEM
|
|
138
138
|
rake (11.0.1)
|
139
139
|
rdoc (4.2.2)
|
140
140
|
json (~> 1.4)
|
141
|
-
responders (2.1.
|
141
|
+
responders (2.1.2)
|
142
142
|
railties (>= 4.2.0, < 5.1)
|
143
143
|
ruby-openid (2.7.0)
|
144
144
|
sprockets (3.5.2)
|
@@ -174,7 +174,7 @@ DEPENDENCIES
|
|
174
174
|
omniauth-facebook
|
175
175
|
omniauth-oauth2 (~> 1.4)
|
176
176
|
omniauth-openid (~> 1.0.1)
|
177
|
-
rails (~> 4.2.
|
177
|
+
rails (~> 4.2.6)
|
178
178
|
rdoc
|
179
179
|
sqlite3
|
180
180
|
webrat (= 0.7.3)
|
data/README.md
CHANGED
@@ -109,7 +109,7 @@ The generator will install an initializer which describes ALL of Devise's config
|
|
109
109
|
rails generate devise MODEL
|
110
110
|
```
|
111
111
|
|
112
|
-
Replace MODEL with the class name used for the application’s users (it’s frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
|
112
|
+
Replace MODEL with the class name used for the application’s users (it’s frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
|
113
113
|
|
114
114
|
Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration. Then run `rake db:migrate`
|
115
115
|
|
@@ -129,6 +129,8 @@ Devise will create some helpers to use inside your controllers and views. To set
|
|
129
129
|
before_action :authenticate_user!
|
130
130
|
```
|
131
131
|
|
132
|
+
For Rails 5, note that `protect_from_forgery` is no longer prepended to the `before_action` chain, so if you have set `authenticate_user` before `protect_from_forgery`, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use `protect_from_forgery prepend: true`.
|
133
|
+
|
132
134
|
If your devise model is something other than User, replace "_user" with "_yourmodel". The same logic applies to the instructions below.
|
133
135
|
|
134
136
|
To verify if a user is signed in, use the following helper:
|
@@ -187,7 +189,7 @@ Besides `:stretches`, you can define `:pepper`, `:encryptor`, `:confirm_within`,
|
|
187
189
|
|
188
190
|
When you customize your own views, you may end up adding new attributes to forms. Rails 4 moved the parameter sanitization from the model to the controller, causing Devise to handle this concern at the controller as well.
|
189
191
|
|
190
|
-
There are just three actions in Devise that allow any set of parameters to be passed down to the model, therefore requiring sanitization. Their names and
|
192
|
+
There are just three actions in Devise that allow any set of parameters to be passed down to the model, therefore requiring sanitization. Their names and default permitted parameters are:
|
191
193
|
|
192
194
|
* `sign_in` (`Devise::SessionsController#create`) - Permits only the authentication keys (like `email`)
|
193
195
|
* `sign_up` (`Devise::RegistrationsController#create`) - Permits authentication keys plus `password` and `password_confirmation`
|
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/rails/activemodel-serializers-xml.git
|
3
|
-
revision:
|
3
|
+
revision: f380ea5ddefcb9a37f4fbc47606ed6fbecdb2b2a
|
4
4
|
specs:
|
5
5
|
activemodel-serializers-xml (1.0.0)
|
6
6
|
activemodel (> 5.x)
|
@@ -73,11 +73,13 @@ GEM
|
|
73
73
|
jwt (1.5.1)
|
74
74
|
loofah (2.0.3)
|
75
75
|
nokogiri (>= 1.5.9)
|
76
|
-
mail (2.6.
|
77
|
-
mime-types (>= 1.16, <
|
76
|
+
mail (2.6.4)
|
77
|
+
mime-types (>= 1.16, < 4)
|
78
78
|
metaclass (0.0.4)
|
79
79
|
method_source (0.8.2)
|
80
|
-
mime-types (
|
80
|
+
mime-types (3.0)
|
81
|
+
mime-types-data (~> 3.2015)
|
82
|
+
mime-types-data (3.2016.0221)
|
81
83
|
mini_portile2 (2.0.0)
|
82
84
|
minitest (5.8.4)
|
83
85
|
mocha (1.1.0)
|
@@ -143,13 +145,13 @@ GEM
|
|
143
145
|
method_source
|
144
146
|
rake (>= 0.8.7)
|
145
147
|
thor (>= 0.18.1, < 2.0)
|
146
|
-
rake (11.
|
148
|
+
rake (11.1.2)
|
147
149
|
rdoc (4.2.2)
|
148
150
|
json (~> 1.4)
|
149
|
-
responders (2.1.
|
151
|
+
responders (2.1.2)
|
150
152
|
railties (>= 4.2.0, < 5.1)
|
151
153
|
ruby-openid (2.7.0)
|
152
|
-
sprockets (3.
|
154
|
+
sprockets (3.6.0)
|
153
155
|
concurrent-ruby (~> 1.0)
|
154
156
|
rack (> 1, < 3)
|
155
157
|
sprockets-rails (3.0.4)
|
data/lib/devise.rb
CHANGED
@@ -53,6 +53,12 @@ module Devise
|
|
53
53
|
# True values used to check params
|
54
54
|
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
55
55
|
|
56
|
+
# Track the configs that user explicit changed the default value. It is
|
57
|
+
# helpfull to not warn users about default values changing when they willing
|
58
|
+
# changed.
|
59
|
+
mattr_accessor :app_set_configs
|
60
|
+
@@app_set_configs = Set.new
|
61
|
+
|
56
62
|
# Secret key used by the key generator
|
57
63
|
mattr_accessor :secret_key
|
58
64
|
@@secret_key = nil
|
@@ -82,9 +88,20 @@ module Devise
|
|
82
88
|
@@case_insensitive_keys = [:email]
|
83
89
|
|
84
90
|
# Keys that should have whitespace stripped.
|
85
|
-
|
91
|
+
# TODO: 4.1 Do: @@strip_whitespace_keys = [:email]
|
92
|
+
mattr_reader :strip_whitespace_keys
|
86
93
|
@@strip_whitespace_keys = []
|
87
94
|
|
95
|
+
def self.strip_whitespace_keys=(strip_whitespace_keys)
|
96
|
+
app_set_configs << :strip_whitespace_keys
|
97
|
+
@@strip_whitespace_keys = strip_whitespace_keys
|
98
|
+
end
|
99
|
+
|
100
|
+
def strip_whitespace_keys=(strip_whitespace_keys)
|
101
|
+
app_set_configs << :strip_whitespace_keys
|
102
|
+
@@strip_whitespace_keys = strip_whitespace_keys
|
103
|
+
end
|
104
|
+
|
88
105
|
# If http authentication is enabled by default.
|
89
106
|
mattr_accessor :http_authenticatable
|
90
107
|
@@http_authenticatable = false
|
@@ -104,9 +121,20 @@ module Devise
|
|
104
121
|
# Email regex used to validate email formats. It simply asserts that
|
105
122
|
# an one (and only one) @ exists in the given string. This is mainly
|
106
123
|
# to give user feedback and not to assert the e-mail validity.
|
107
|
-
|
124
|
+
# TODO: 4.1 Do: @@email_regexp = [/\A[^@\s]+@[^@\s]+\z/]
|
125
|
+
mattr_reader :email_regexp
|
108
126
|
@@email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
|
109
127
|
|
128
|
+
def self.email_regexp=(email_regexp)
|
129
|
+
app_set_configs << :email_regexp
|
130
|
+
@@email_regexp = email_regexp
|
131
|
+
end
|
132
|
+
|
133
|
+
def email_regexp=(email_regexp)
|
134
|
+
app_set_configs << :email_regexp
|
135
|
+
@@email_regexp = email_regexp
|
136
|
+
end
|
137
|
+
|
110
138
|
# Range validation for password length
|
111
139
|
mattr_accessor :password_length
|
112
140
|
@@password_length = 6..128
|
@@ -115,7 +143,6 @@ module Devise
|
|
115
143
|
mattr_accessor :remember_for
|
116
144
|
@@remember_for = 2.weeks
|
117
145
|
|
118
|
-
# TODO: extend_remember_period is no longer used
|
119
146
|
# If true, extends the user's remember period when remembered via cookie.
|
120
147
|
mattr_accessor :extend_remember_period
|
121
148
|
@@extend_remember_period = false
|
@@ -139,9 +166,20 @@ module Devise
|
|
139
166
|
|
140
167
|
# Defines if email should be reconfirmable.
|
141
168
|
# False by default for backwards compatibility.
|
142
|
-
|
169
|
+
# TODO: 4.1 Do: @@reconfirmable = true
|
170
|
+
mattr_reader :reconfirmable
|
143
171
|
@@reconfirmable = false
|
144
172
|
|
173
|
+
def self.reconfirmable=(reconfirmable)
|
174
|
+
app_set_configs << :reconfirmable
|
175
|
+
@@reconfirmable = reconfirmable
|
176
|
+
end
|
177
|
+
|
178
|
+
def reconfirmable=(reconfirmable)
|
179
|
+
app_set_configs << :reconfirmable
|
180
|
+
@@reconfirmable = reconfirmable
|
181
|
+
end
|
182
|
+
|
145
183
|
# Time interval to timeout the user session without activity.
|
146
184
|
mattr_accessor :timeout_in
|
147
185
|
@@timeout_in = 30.minutes
|
@@ -202,9 +240,20 @@ module Devise
|
|
202
240
|
@@mailer_sender = nil
|
203
241
|
|
204
242
|
# Skip session storage for the following strategies
|
205
|
-
|
243
|
+
# TODO: 4.1 Do: @@skip_session_storage = [:http_auth]
|
244
|
+
mattr_reader :skip_session_storage
|
206
245
|
@@skip_session_storage = []
|
207
246
|
|
247
|
+
def self.skip_session_storage=(skip_session_storage)
|
248
|
+
app_set_configs << :skip_session_storage
|
249
|
+
@@skip_session_storage = skip_session_storage
|
250
|
+
end
|
251
|
+
|
252
|
+
def skip_session_storage=(skip_session_storage)
|
253
|
+
app_set_configs << :skip_session_storage
|
254
|
+
@@skip_session_storage = skip_session_storage
|
255
|
+
end
|
256
|
+
|
208
257
|
# Which formats should be treated as navigational.
|
209
258
|
mattr_accessor :navigational_formats
|
210
259
|
@@navigational_formats = ["*/*", :html]
|
@@ -214,9 +263,20 @@ module Devise
|
|
214
263
|
@@sign_out_all_scopes = true
|
215
264
|
|
216
265
|
# The default method used while signing out
|
217
|
-
|
266
|
+
# TODO: 4.1 Do: @@sign_out_via = :delete
|
267
|
+
mattr_reader :sign_out_via
|
218
268
|
@@sign_out_via = :get
|
219
269
|
|
270
|
+
def self.sign_out_via=(sign_out_via)
|
271
|
+
app_set_configs << :sign_out_via
|
272
|
+
@@sign_out_via = sign_out_via
|
273
|
+
end
|
274
|
+
|
275
|
+
def sign_out_via=(sign_out_via)
|
276
|
+
app_set_configs << :sign_out_via
|
277
|
+
@@sign_out_via = sign_out_via
|
278
|
+
end
|
279
|
+
|
220
280
|
# The parent controller all Devise controllers inherits from.
|
221
281
|
# Defaults to ApplicationController. This should be set early
|
222
282
|
# in the initialization process and should be set to a string.
|
@@ -280,6 +340,32 @@ module Devise
|
|
280
340
|
# a fresh initializer with all configuration values.
|
281
341
|
def self.setup
|
282
342
|
yield self
|
343
|
+
|
344
|
+
warn_default_config_changed(:email_regexp, '/\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/', '/\A[^@\s]+@[^@\s]+\z/')
|
345
|
+
warn_default_config_changed(:reconfirmable, 'false', 'true')
|
346
|
+
warn_default_config_changed(:sign_out_via, ':get', ':delete')
|
347
|
+
warn_default_config_changed(:skip_session_storage, '[]', '[:http_auth]')
|
348
|
+
warn_default_config_changed(:strip_whitespace_keys, '[]', '[:email]')
|
349
|
+
end
|
350
|
+
|
351
|
+
def self.warn_default_config_changed(config, current_default, new_default)
|
352
|
+
unless app_set_configs.include?(config)
|
353
|
+
warn = <<-MESSAGE.strip_heredoc
|
354
|
+
[Devise] config.#{config} will have a new default on Devise 4.1
|
355
|
+
To keep the current behavior please set in your config/initializers/devise.rb the following:
|
356
|
+
|
357
|
+
Devise.setup do |config|
|
358
|
+
config.#{config} = #{current_default}
|
359
|
+
end
|
360
|
+
|
361
|
+
If you want to use the new default:
|
362
|
+
|
363
|
+
Devise.setup do |config|
|
364
|
+
config.#{config} = #{new_default}
|
365
|
+
end
|
366
|
+
MESSAGE
|
367
|
+
ActiveSupport::Deprecation.warn(warn)
|
368
|
+
end
|
283
369
|
end
|
284
370
|
|
285
371
|
class Getter
|
@@ -271,12 +271,6 @@ module Devise
|
|
271
271
|
|
272
272
|
private
|
273
273
|
|
274
|
-
def expire_session_data_after_sign_in!
|
275
|
-
ActiveSupport::Deprecation.warn "expire_session_data_after_sign_in! is deprecated " \
|
276
|
-
"in favor of expire_data_after_sign_in!"
|
277
|
-
expire_data_after_sign_in!
|
278
|
-
end
|
279
|
-
|
280
274
|
def expire_data_after_sign_out!
|
281
275
|
Devise.mappings.each { |_,m| instance_variable_set("@current_#{m.name}", nil) }
|
282
276
|
super
|
@@ -39,15 +39,13 @@ module Devise
|
|
39
39
|
module Rememberable
|
40
40
|
extend ActiveSupport::Concern
|
41
41
|
|
42
|
-
attr_accessor :remember_me
|
42
|
+
attr_accessor :remember_me
|
43
43
|
|
44
44
|
def self.required_fields(klass)
|
45
45
|
[:remember_created_at]
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
# Remove this for Devise 4.0.
|
50
|
-
def remember_me!(*)
|
48
|
+
def remember_me!
|
51
49
|
self.remember_token = self.class.remember_token if respond_to?(:remember_token)
|
52
50
|
self.remember_created_at ||= Time.now.utc
|
53
51
|
save(validate: false) if self.changed?
|
@@ -66,6 +64,10 @@ module Devise
|
|
66
64
|
self.class.remember_for.from_now
|
67
65
|
end
|
68
66
|
|
67
|
+
def extend_remember_period
|
68
|
+
self.class.extend_remember_period
|
69
|
+
end
|
70
|
+
|
69
71
|
def rememberable_value
|
70
72
|
if respond_to?(:remember_token)
|
71
73
|
remember_token
|
@@ -147,9 +149,6 @@ module Devise
|
|
147
149
|
end
|
148
150
|
end
|
149
151
|
|
150
|
-
private
|
151
|
-
|
152
|
-
# TODO: extend_remember_period is no longer used
|
153
152
|
Devise::Models.config(self, :remember_for, :extend_remember_period, :rememberable_options, :expire_all_remember_me_on_sign_out)
|
154
153
|
end
|
155
154
|
end
|
@@ -169,7 +169,7 @@ module Devise
|
|
169
169
|
If you want to define a new set of parameters to be sanitized use the
|
170
170
|
`permit` method first:
|
171
171
|
|
172
|
-
devise_parameter_sanitizer.permit(:#{action}, keys: [:param1, param2, param3])
|
172
|
+
devise_parameter_sanitizer.permit(:#{action}, keys: [:param1, :param2, :param3])
|
173
173
|
MESSAGE
|
174
174
|
end
|
175
175
|
|
@@ -25,8 +25,7 @@ module Devise
|
|
25
25
|
end
|
26
26
|
|
27
27
|
if validate(resource)
|
28
|
-
remember_me(resource)
|
29
|
-
extend_remember_me_period(resource)
|
28
|
+
remember_me(resource) if extend_remember_me?(resource)
|
30
29
|
resource.after_remembered
|
31
30
|
success!(resource)
|
32
31
|
end
|
@@ -43,10 +42,8 @@ module Devise
|
|
43
42
|
|
44
43
|
private
|
45
44
|
|
46
|
-
def
|
47
|
-
|
48
|
-
resource.extend_remember_period = mapping.to.extend_remember_period
|
49
|
-
end
|
45
|
+
def extend_remember_me?(resource)
|
46
|
+
resource.respond_to?(:extend_remember_period) && resource.extend_remember_period
|
50
47
|
end
|
51
48
|
|
52
49
|
def remember_me?
|
data/lib/devise/version.rb
CHANGED
@@ -148,12 +148,12 @@ Devise.setup do |config|
|
|
148
148
|
|
149
149
|
# ==> Configuration for :validatable
|
150
150
|
# Range for password length.
|
151
|
-
config.password_length =
|
151
|
+
config.password_length = 6..128
|
152
152
|
|
153
153
|
# Email regex used to validate email formats. It simply asserts that
|
154
154
|
# one (and only one) @ exists in the given string. This is mainly
|
155
155
|
# to give user feedback and not to assert the e-mail validity.
|
156
|
-
|
156
|
+
config.email_regexp = /\A[^@]+@[^@]+\z/
|
157
157
|
|
158
158
|
# ==> Configuration for :timeoutable
|
159
159
|
# The time you want to timeout the user session without activity. After this
|
data/test/devise_test.rb
CHANGED
@@ -35,6 +35,33 @@ class DeviseTest < ActiveSupport::TestCase
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
test 'setup block warns about defaults changing' do
|
39
|
+
Devise.app_set_configs = Set.new
|
40
|
+
|
41
|
+
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /email_regexp/ }
|
42
|
+
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /reconfirmable/ }
|
43
|
+
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /sign_out_via/ }
|
44
|
+
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /skip_session_storage/ }
|
45
|
+
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /strip_whitespace_keys/ }
|
46
|
+
|
47
|
+
Devise.setup do
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'setup block doest not warns when the change is explicit set' do
|
52
|
+
ActiveSupport::Deprecation.expects(:warn).never
|
53
|
+
|
54
|
+
swap Devise,
|
55
|
+
email_regexp: /@/,
|
56
|
+
reconfirmable: false,
|
57
|
+
sign_out_via: :get,
|
58
|
+
skip_session_storage: [],
|
59
|
+
strip_whitespace_keys: [] do
|
60
|
+
Devise.setup do
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
38
65
|
test 'stores warden configuration' do
|
39
66
|
assert_kind_of Devise::Delegator, Devise.warden_config.failure_app
|
40
67
|
assert_equal :user, Devise.warden_config.default_scope
|
@@ -94,7 +94,6 @@ class RememberMeTest < Devise::IntegrationTest
|
|
94
94
|
assert_response :success
|
95
95
|
assert warden.authenticated?(:user)
|
96
96
|
assert warden.user(:user) == user
|
97
|
-
assert_match /remember_user_token[^\n]*HttpOnly/, response.headers["Set-Cookie"], "Expected Set-Cookie header in response to set HttpOnly flag on remember_user_token cookie."
|
98
97
|
end
|
99
98
|
|
100
99
|
test 'remember the user before sign up and redirect them to their home' do
|
@@ -120,6 +119,40 @@ class RememberMeTest < Devise::IntegrationTest
|
|
120
119
|
end
|
121
120
|
end
|
122
121
|
|
122
|
+
test 'extends remember period when extend remember period config is true' do
|
123
|
+
swap Devise, extend_remember_period: true, remember_for: 1.year do
|
124
|
+
user = create_user_and_remember
|
125
|
+
old_remember_token = nil
|
126
|
+
|
127
|
+
travel_to 1.day.ago do
|
128
|
+
get root_path
|
129
|
+
old_remember_token = request.cookies['remember_user_token']
|
130
|
+
end
|
131
|
+
|
132
|
+
get root_path
|
133
|
+
current_remember_token = request.cookies['remember_user_token']
|
134
|
+
|
135
|
+
refute_equal old_remember_token, current_remember_token
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
test 'does not extend remember period when extend period config is false' do
|
140
|
+
swap Devise, extend_remember_period: false, remember_for: 1.year do
|
141
|
+
user = create_user_and_remember
|
142
|
+
old_remember_token = nil
|
143
|
+
|
144
|
+
travel_to 1.day.ago do
|
145
|
+
get root_path
|
146
|
+
old_remember_token = request.cookies['remember_user_token']
|
147
|
+
end
|
148
|
+
|
149
|
+
get root_path
|
150
|
+
current_remember_token = request.cookies['remember_user_token']
|
151
|
+
|
152
|
+
assert_equal old_remember_token, current_remember_token
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
123
156
|
test 'do not remember other scopes' do
|
124
157
|
create_user_and_remember
|
125
158
|
get root_path
|
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.0
|
4
|
+
version: 4.0.0
|
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-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
@@ -362,9 +362,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
362
362
|
version: 2.1.0
|
363
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
364
364
|
requirements:
|
365
|
-
- - "
|
365
|
+
- - ">="
|
366
366
|
- !ruby/object:Gem::Version
|
367
|
-
version:
|
367
|
+
version: '0'
|
368
368
|
requirements: []
|
369
369
|
rubyforge_project:
|
370
370
|
rubygems_version: 2.5.1
|
@@ -504,4 +504,3 @@ test_files:
|
|
504
504
|
- test/test_helper.rb
|
505
505
|
- test/test_helpers_test.rb
|
506
506
|
- test/test_models.rb
|
507
|
-
has_rdoc:
|