devise 4.9.0 → 4.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -1
- data/README.md +4 -4
- data/app/controllers/devise/passwords_controller.rb +2 -2
- data/app/controllers/devise_controller.rb +13 -0
- data/app/helpers/devise_helper.rb +1 -1
- data/lib/devise/controllers/sign_in_out.rb +1 -1
- data/lib/devise/failure_app.rb +3 -1
- data/lib/devise/models/authenticatable.rb +1 -1
- data/lib/devise/models/confirmable.rb +16 -37
- data/lib/devise/models/database_authenticatable.rb +9 -28
- data/lib/devise/models/recoverable.rb +5 -16
- data/lib/devise/models/validatable.rb +3 -8
- data/lib/devise/models.rb +1 -0
- data/lib/devise/orm.rb +71 -0
- data/lib/devise/rails/deprecated_constant_accessor.rb +1 -1
- data/lib/devise/rails.rb +4 -0
- data/lib/devise/test/controller_helpers.rb +1 -1
- data/lib/devise/test_helpers.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/devise.rb +13 -4
- data/lib/generators/templates/devise.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc134957d3855a45dd68b04b36bca2a993b095b1c05f5d87f4a68d2469660df
|
4
|
+
data.tar.gz: '09de3502b6e5afdb42d9c34b7896dfd9fcc0d58fa088951a2aab2f39095246c4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2413954e6decdda1c1e0adf5bf39b8ede790ef90dfc61d433528e28948f248a598ac1772b2606ff1b79f07ae330aec153e92b53aa0b2708a1b7ca19156034e81
|
7
|
+
data.tar.gz: a04f21e33fb88287ff808102c76e550a70165b2fddbde92c3984a4fa3c325fe507b68366c4b1a11d847ddce3e3722e4bda7d09642f140a872c7c0c73de32ba50
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
-
###
|
1
|
+
### 4.9.3 - 2023-10-11
|
2
2
|
|
3
|
+
* enhancements
|
4
|
+
* Add support for Rails 7.1.
|
5
|
+
* Add `Devise.deprecator` to integrate with new application deprecators in Rails 7.1. (@soartec-lab, @etiennebarrie)
|
6
|
+
|
7
|
+
### 4.9.2 - 2023-04-03
|
8
|
+
|
9
|
+
* deprecations
|
10
|
+
* Bring back `Devise.activerecord51?` and deprecate it, in order to avoid breakage with some libraries that apparently relied on it.
|
11
|
+
|
12
|
+
### 4.9.1 - 2023-03-31
|
13
|
+
|
14
|
+
* enhancements
|
15
|
+
* Allow resource class scopes to override the global configuration for `sign_in_after_reset_password` behaviour. [#5429](https://github.com/heartcombo/devise/pull/5429) [@mattr](https://github.com/mattr)
|
16
|
+
* Refactor conditional dirty tracking logic to a centralized module to simplify usage throughout the codebase. [#5575](https://github.com/heartcombo/devise/pull/5575)
|
17
|
+
* Improve support for Devise in apps with Active Record and Mongoid ORMs loaded, so it does not incorrectly uses new Active Record dirty tracking APIs with a Mongoid Devise model. [#5576](https://github.com/heartcombo/devise/pull/5576)
|
18
|
+
|
19
|
+
* bug fixes
|
20
|
+
* Failure app will respond with configured `redirect_status` instead of `error_status` if the recall app returns a redirect status (300..399) [#5573](https://github.com/heartcombo/devise/pull/5573)
|
21
|
+
* Fix frozen string exception in validatable. [#5563](https://github.com/heartcombo/devise/pull/5563) [#5465](https://github.com/heartcombo/devise/pull/5465) [@mameier](https://github.com/mameier)
|
3
22
|
|
4
23
|
### 4.9.0 - 2023-02-17
|
5
24
|
|
data/README.md
CHANGED
@@ -382,7 +382,7 @@ $ rails generate devise:views users
|
|
382
382
|
```
|
383
383
|
|
384
384
|
If you would like to generate only a few sets of views, like the ones for the `registerable` and `confirmable` module,
|
385
|
-
you can pass a list of
|
385
|
+
you can pass a list of views to the generator with the `-v` flag.
|
386
386
|
|
387
387
|
```console
|
388
388
|
$ rails generate devise:views -v registrations confirmations
|
@@ -410,7 +410,7 @@ If the customization at the views level is not enough, you can customize each co
|
|
410
410
|
...
|
411
411
|
end
|
412
412
|
```
|
413
|
-
|
413
|
+
Use the `-c` flag to specify one or more controllers, for example: `rails generate devise:controllers users -c sessions`)
|
414
414
|
|
415
415
|
2. Tell the router to use this controller:
|
416
416
|
|
@@ -418,7 +418,7 @@ If the customization at the views level is not enough, you can customize each co
|
|
418
418
|
devise_for :users, controllers: { sessions: 'users/sessions' }
|
419
419
|
```
|
420
420
|
|
421
|
-
3.
|
421
|
+
3. Recommended but not required: copy (or move) the views from `devise/sessions` to `users/sessions`. Rails will continue using the views from `devise/sessions` due to inheritance if you skip this step, but having the views matching the controller(s) keeps things consistent.
|
422
422
|
|
423
423
|
4. Finally, change or extend the desired controller actions.
|
424
424
|
|
@@ -483,7 +483,7 @@ Devise.setup do |config|
|
|
483
483
|
# ...
|
484
484
|
# When using Devise with Hotwire/Turbo, the http status for error responses
|
485
485
|
# and some redirects must match the following. The default in Devise for existing
|
486
|
-
# apps is `200 OK` and `302 Found respectively
|
486
|
+
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
487
487
|
# these new defaults that match Hotwire/Turbo behavior.
|
488
488
|
# Note: These might become the new default in future versions of Devise.
|
489
489
|
config.responder.error_status = :unprocessable_entity
|
@@ -36,7 +36,7 @@ class Devise::PasswordsController < DeviseController
|
|
36
36
|
|
37
37
|
if resource.errors.empty?
|
38
38
|
resource.unlock_access! if unlockable?(resource)
|
39
|
-
if
|
39
|
+
if resource_class.sign_in_after_reset_password
|
40
40
|
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
|
41
41
|
set_flash_message!(:notice, flash_message)
|
42
42
|
resource.after_database_authentication
|
@@ -53,7 +53,7 @@ class Devise::PasswordsController < DeviseController
|
|
53
53
|
|
54
54
|
protected
|
55
55
|
def after_resetting_password_path_for(resource)
|
56
|
-
|
56
|
+
resource_class.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
|
57
57
|
end
|
58
58
|
|
59
59
|
# The path used after sending reset password instructions
|
@@ -33,6 +33,19 @@ class DeviseController < Devise.parent_controller.constantize
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# Override internal methods to exclude `_prefixes` from action methods since
|
37
|
+
# we override it above.
|
38
|
+
#
|
39
|
+
# There was an intentional change in Rails 7.1 that will allow it to become
|
40
|
+
# an action method because it's a public method of a non-abstract controller,
|
41
|
+
# but we also can't make this abstract because it can affect potential actions
|
42
|
+
# defined in the parent controller, so instead we ensure `_prefixes` is going
|
43
|
+
# to be considered internal. (and thus, won't become an action method.)
|
44
|
+
# Ref: https://github.com/rails/rails/pull/48699
|
45
|
+
def self.internal_methods #:nodoc:
|
46
|
+
super << :_prefixes
|
47
|
+
end
|
48
|
+
|
36
49
|
protected
|
37
50
|
|
38
51
|
# Gets the actual resource stored in the instance variable
|
@@ -4,7 +4,7 @@ module DeviseHelper
|
|
4
4
|
# Retain this method for backwards compatibility, deprecated in favor of modifying the
|
5
5
|
# devise/shared/error_messages partial.
|
6
6
|
def devise_error_messages!
|
7
|
-
|
7
|
+
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
8
8
|
[Devise] `DeviseHelper#devise_error_messages!` is deprecated and will be
|
9
9
|
removed in the next major version.
|
10
10
|
|
@@ -38,7 +38,7 @@ module Devise
|
|
38
38
|
expire_data_after_sign_in!
|
39
39
|
|
40
40
|
if options[:bypass]
|
41
|
-
|
41
|
+
Devise.deprecator.warn(<<-DEPRECATION.strip_heredoc, caller)
|
42
42
|
[Devise] bypass option is deprecated and it will be removed in future version of Devise.
|
43
43
|
Please use bypass_sign_in method instead.
|
44
44
|
Example:
|
data/lib/devise/failure_app.rb
CHANGED
@@ -72,7 +72,9 @@ module Devise
|
|
72
72
|
|
73
73
|
flash.now[:alert] = i18n_message(:invalid) if is_flashing_format?
|
74
74
|
self.response = recall_app(warden_options[:recall]).call(request.env).tap { |response|
|
75
|
-
response[0] = Rack::Utils.status_code(
|
75
|
+
response[0] = Rack::Utils.status_code(
|
76
|
+
response[0].in?(300..399) ? Devise.responder.redirect_status : Devise.responder.error_status
|
77
|
+
)
|
76
78
|
}
|
77
79
|
end
|
78
80
|
|
@@ -62,7 +62,7 @@ module Devise
|
|
62
62
|
:remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at]
|
63
63
|
|
64
64
|
include Devise::DeprecatedConstantAccessor
|
65
|
-
deprecate_constant "BLACKLIST_FOR_SERIALIZATION", "Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION"
|
65
|
+
deprecate_constant "BLACKLIST_FOR_SERIALIZATION", "Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION", deprecator: Devise.deprecator
|
66
66
|
|
67
67
|
included do
|
68
68
|
class_attribute :devise_modules, instance_writer: false
|
@@ -48,7 +48,7 @@ module Devise
|
|
48
48
|
included do
|
49
49
|
before_create :generate_confirmation_token, if: :confirmation_required?
|
50
50
|
after_create :skip_reconfirmation_in_callback!, if: :send_confirmation_notification?
|
51
|
-
if
|
51
|
+
if Devise::Orm.active_record?(self) # ActiveRecord
|
52
52
|
after_commit :send_on_create_confirmation_instructions, on: :create, if: :send_confirmation_notification?
|
53
53
|
after_commit :send_reconfirmation_instructions, on: :update, if: :reconfirmation_required?
|
54
54
|
else # Mongoid
|
@@ -258,44 +258,23 @@ module Devise
|
|
258
258
|
generate_confirmation_token && save(validate: false)
|
259
259
|
end
|
260
260
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
end
|
269
|
-
else
|
270
|
-
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
271
|
-
@reconfirmation_required = true
|
272
|
-
self.unconfirmed_email = self.email
|
273
|
-
self.email = self.email_was
|
274
|
-
self.confirmation_token = nil
|
275
|
-
generate_confirmation_token
|
276
|
-
end
|
261
|
+
|
262
|
+
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
263
|
+
@reconfirmation_required = true
|
264
|
+
self.unconfirmed_email = self.email
|
265
|
+
self.email = self.devise_email_in_database
|
266
|
+
self.confirmation_token = nil
|
267
|
+
generate_confirmation_token
|
277
268
|
end
|
278
269
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
postpone
|
288
|
-
end
|
289
|
-
else
|
290
|
-
def postpone_email_change?
|
291
|
-
postpone = self.class.reconfirmable &&
|
292
|
-
email_changed? &&
|
293
|
-
!@bypass_confirmation_postpone &&
|
294
|
-
self.email.present? &&
|
295
|
-
(!@skip_reconfirmation_in_callback || !self.email_was.nil?)
|
296
|
-
@bypass_confirmation_postpone = false
|
297
|
-
postpone
|
298
|
-
end
|
270
|
+
def postpone_email_change?
|
271
|
+
postpone = self.class.reconfirmable &&
|
272
|
+
devise_will_save_change_to_email? &&
|
273
|
+
!@bypass_confirmation_postpone &&
|
274
|
+
self.email.present? &&
|
275
|
+
(!@skip_reconfirmation_in_callback || !self.devise_email_in_database.nil?)
|
276
|
+
@bypass_confirmation_postpone = false
|
277
|
+
postpone
|
299
278
|
end
|
300
279
|
|
301
280
|
def reconfirmation_required?
|
@@ -86,7 +86,7 @@ module Devise
|
|
86
86
|
# is also rejected as long as it is also blank.
|
87
87
|
def update_with_password(params, *options)
|
88
88
|
if options.present?
|
89
|
-
|
89
|
+
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
90
90
|
[Devise] The second argument of `DatabaseAuthenticatable#update_with_password`
|
91
91
|
(`options`) is deprecated and it will be removed in the next major version.
|
92
92
|
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
@@ -128,7 +128,7 @@ module Devise
|
|
128
128
|
#
|
129
129
|
def update_without_password(params, *options)
|
130
130
|
if options.present?
|
131
|
-
|
131
|
+
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
132
132
|
[Devise] The second argument of `DatabaseAuthenticatable#update_without_password`
|
133
133
|
(`options`) is deprecated and it will be removed in the next major version.
|
134
134
|
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
@@ -177,16 +177,9 @@ module Devise
|
|
177
177
|
encrypted_password[0,29] if encrypted_password
|
178
178
|
end
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
send_devise_notification(:email_changed, to: email_before_last_save)
|
184
|
-
end
|
185
|
-
else
|
186
|
-
# Send notification to user when email changes.
|
187
|
-
def send_email_changed_notification
|
188
|
-
send_devise_notification(:email_changed, to: email_was)
|
189
|
-
end
|
180
|
+
# Send notification to user when email changes.
|
181
|
+
def send_email_changed_notification
|
182
|
+
send_devise_notification(:email_changed, to: devise_email_before_last_save)
|
190
183
|
end
|
191
184
|
|
192
185
|
# Send notification to user when password changes.
|
@@ -205,24 +198,12 @@ module Devise
|
|
205
198
|
Devise::Encryptor.digest(self.class, password)
|
206
199
|
end
|
207
200
|
|
208
|
-
|
209
|
-
|
210
|
-
self.class.send_email_changed_notification && saved_change_to_email? && !@skip_email_changed_notification
|
211
|
-
end
|
212
|
-
else
|
213
|
-
def send_email_changed_notification?
|
214
|
-
self.class.send_email_changed_notification && email_changed? && !@skip_email_changed_notification
|
215
|
-
end
|
201
|
+
def send_email_changed_notification?
|
202
|
+
self.class.send_email_changed_notification && devise_saved_change_to_email? && !@skip_email_changed_notification
|
216
203
|
end
|
217
204
|
|
218
|
-
|
219
|
-
|
220
|
-
self.class.send_password_change_notification && saved_change_to_encrypted_password? && !@skip_password_change_notification
|
221
|
-
end
|
222
|
-
else
|
223
|
-
def send_password_change_notification?
|
224
|
-
self.class.send_password_change_notification && encrypted_password_changed? && !@skip_password_change_notification
|
225
|
-
end
|
205
|
+
def send_password_change_notification?
|
206
|
+
self.class.send_password_change_notification && devise_saved_change_to_encrypted_password? && !@skip_password_change_notification
|
226
207
|
end
|
227
208
|
|
228
209
|
module ClassMethods
|
@@ -99,24 +99,13 @@ module Devise
|
|
99
99
|
send_devise_notification(:reset_password_instructions, token, {})
|
100
100
|
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
respond_to?("will_save_change_to_#{attribute}?") && send("will_save_change_to_#{attribute}?")
|
107
|
-
end
|
108
|
-
|
109
|
-
authentication_keys_changed || encrypted_password_changed
|
102
|
+
def clear_reset_password_token?
|
103
|
+
encrypted_password_changed = devise_respond_to_and_will_save_change_to_attribute?(:encrypted_password)
|
104
|
+
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
105
|
+
devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
110
106
|
end
|
111
|
-
else
|
112
|
-
def clear_reset_password_token?
|
113
|
-
encrypted_password_changed = respond_to?(:encrypted_password_changed?) && encrypted_password_changed?
|
114
|
-
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
115
|
-
respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
|
116
|
-
end
|
117
107
|
|
118
|
-
|
119
|
-
end
|
108
|
+
authentication_keys_changed || encrypted_password_changed
|
120
109
|
end
|
121
110
|
|
122
111
|
module ClassMethods
|
@@ -29,13 +29,8 @@ module Devise
|
|
29
29
|
|
30
30
|
base.class_eval do
|
31
31
|
validates_presence_of :email, if: :email_required?
|
32
|
-
if
|
33
|
-
|
34
|
-
validates_format_of :email, with: email_regexp, allow_blank: true, if: :will_save_change_to_email?
|
35
|
-
else
|
36
|
-
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
37
|
-
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
38
|
-
end
|
32
|
+
validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :devise_will_save_change_to_email?
|
33
|
+
validates_format_of :email, with: email_regexp, allow_blank: true, if: :devise_will_save_change_to_email?
|
39
34
|
|
40
35
|
validates_presence_of :password, if: :password_required?
|
41
36
|
validates_confirmation_of :password, if: :password_required?
|
@@ -47,7 +42,7 @@ module Devise
|
|
47
42
|
unavailable_validations = VALIDATIONS.select { |v| !base.respond_to?(v) }
|
48
43
|
|
49
44
|
unless unavailable_validations.empty?
|
50
|
-
raise "Could not use :validatable module since #{base} does not respond "
|
45
|
+
raise "Could not use :validatable module since #{base} does not respond " \
|
51
46
|
"to the following methods: #{unavailable_validations.to_sentence}."
|
52
47
|
end
|
53
48
|
end
|
data/lib/devise/models.rb
CHANGED
data/lib/devise/orm.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
module Devise
|
2
|
+
module Orm # :nodoc:
|
3
|
+
def self.active_record?(model)
|
4
|
+
defined?(ActiveRecord) && model < ActiveRecord::Base
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.active_record_51?(model)
|
8
|
+
active_record?(model) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.included(model)
|
12
|
+
if Devise::Orm.active_record_51?(model)
|
13
|
+
model.include DirtyTrackingNewMethods
|
14
|
+
else
|
15
|
+
model.include DirtyTrackingOldMethods
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module DirtyTrackingNewMethods
|
20
|
+
def devise_email_before_last_save
|
21
|
+
email_before_last_save
|
22
|
+
end
|
23
|
+
|
24
|
+
def devise_email_in_database
|
25
|
+
email_in_database
|
26
|
+
end
|
27
|
+
|
28
|
+
def devise_saved_change_to_email?
|
29
|
+
saved_change_to_email?
|
30
|
+
end
|
31
|
+
|
32
|
+
def devise_saved_change_to_encrypted_password?
|
33
|
+
saved_change_to_encrypted_password?
|
34
|
+
end
|
35
|
+
|
36
|
+
def devise_will_save_change_to_email?
|
37
|
+
will_save_change_to_email?
|
38
|
+
end
|
39
|
+
|
40
|
+
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
41
|
+
respond_to?("will_save_change_to_#{attribute}?") && send("will_save_change_to_#{attribute}?")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module DirtyTrackingOldMethods
|
46
|
+
def devise_email_before_last_save
|
47
|
+
email_was
|
48
|
+
end
|
49
|
+
|
50
|
+
def devise_email_in_database
|
51
|
+
email_was
|
52
|
+
end
|
53
|
+
|
54
|
+
def devise_saved_change_to_email?
|
55
|
+
email_changed?
|
56
|
+
end
|
57
|
+
|
58
|
+
def devise_saved_change_to_encrypted_password?
|
59
|
+
encrypted_password_changed?
|
60
|
+
end
|
61
|
+
|
62
|
+
def devise_will_save_change_to_email?
|
63
|
+
email_changed?
|
64
|
+
end
|
65
|
+
|
66
|
+
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
67
|
+
respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -26,7 +26,7 @@ rescue LoadError
|
|
26
26
|
super
|
27
27
|
end
|
28
28
|
|
29
|
-
def deprecate_constant(const_name, new_constant, message: nil, deprecator:
|
29
|
+
def deprecate_constant(const_name, new_constant, message: nil, deprecator: Devise.deprecator)
|
30
30
|
class_variable_set(:@@_deprecated_constants, {}) unless class_variable_defined?(:@@_deprecated_constants)
|
31
31
|
class_variable_get(:@@_deprecated_constants)[const_name.to_s] = { new: new_constant, message: message, deprecator: deprecator }
|
32
32
|
end
|
data/lib/devise/rails.rb
CHANGED
@@ -17,6 +17,10 @@ module Devise
|
|
17
17
|
app.reload_routes! if Devise.reload_routes
|
18
18
|
end
|
19
19
|
|
20
|
+
initializer "devise.deprecator" do |app|
|
21
|
+
app.deprecators[:devise] = Devise.deprecator if app.respond_to?(:deprecators)
|
22
|
+
end
|
23
|
+
|
20
24
|
initializer "devise.url_helpers" do
|
21
25
|
Devise.include_helpers(Devise::Controllers)
|
22
26
|
end
|
@@ -69,7 +69,7 @@ module Devise
|
|
69
69
|
scope = resource
|
70
70
|
resource = deprecated
|
71
71
|
|
72
|
-
|
72
|
+
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
73
73
|
[Devise] sign_in(:#{scope}, resource) on controller tests is deprecated and will be removed from Devise.
|
74
74
|
Please use sign_in(resource, scope: :#{scope}) instead.
|
75
75
|
DEPRECATION
|
data/lib/devise/test_helpers.rb
CHANGED
@@ -4,7 +4,7 @@ module Devise
|
|
4
4
|
module TestHelpers
|
5
5
|
def self.included(base)
|
6
6
|
base.class_eval do
|
7
|
-
|
7
|
+
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
8
8
|
[Devise] including `Devise::TestHelpers` is deprecated and will be removed from Devise.
|
9
9
|
For controller tests, please include `Devise::Test::ControllerHelpers` instead.
|
10
10
|
DEPRECATION
|
data/lib/devise/version.rb
CHANGED
data/lib/devise.rb
CHANGED
@@ -13,6 +13,7 @@ module Devise
|
|
13
13
|
autoload :Encryptor, 'devise/encryptor'
|
14
14
|
autoload :FailureApp, 'devise/failure_app'
|
15
15
|
autoload :OmniAuth, 'devise/omniauth'
|
16
|
+
autoload :Orm, 'devise/orm'
|
16
17
|
autoload :ParameterFilter, 'devise/parameter_filter'
|
17
18
|
autoload :ParameterSanitizer, 'devise/parameter_sanitizer'
|
18
19
|
autoload :TestHelpers, 'devise/test_helpers'
|
@@ -307,10 +308,6 @@ module Devise
|
|
307
308
|
mattr_accessor :sign_in_after_change_password
|
308
309
|
@@sign_in_after_change_password = true
|
309
310
|
|
310
|
-
def self.activerecord51? # :nodoc:
|
311
|
-
defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
312
|
-
end
|
313
|
-
|
314
311
|
# Default way to set up Devise. Run rails generate devise_install to create
|
315
312
|
# a fresh initializer with all configuration values.
|
316
313
|
def self.setup
|
@@ -523,6 +520,18 @@ module Devise
|
|
523
520
|
b.each_byte { |byte| res |= byte ^ l.shift }
|
524
521
|
res == 0
|
525
522
|
end
|
523
|
+
|
524
|
+
def self.deprecator
|
525
|
+
@deprecator ||= ActiveSupport::Deprecation.new("5.0", "Devise")
|
526
|
+
end
|
527
|
+
|
528
|
+
def self.activerecord51? # :nodoc:
|
529
|
+
deprecator.warn <<-DEPRECATION.strip_heredoc
|
530
|
+
[Devise] `Devise.activerecord51?` is deprecated and will be removed in the next major version.
|
531
|
+
It is a non-public method that's no longer used internally, but that other libraries have been relying on.
|
532
|
+
DEPRECATION
|
533
|
+
defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
534
|
+
end
|
526
535
|
end
|
527
536
|
|
528
537
|
require 'warden'
|
@@ -299,7 +299,7 @@ Devise.setup do |config|
|
|
299
299
|
# ==> Hotwire/Turbo configuration
|
300
300
|
# When using Devise with Hotwire/Turbo, the http status for error responses
|
301
301
|
# and some redirects must match the following. The default in Devise for existing
|
302
|
-
# apps is `200 OK` and `302 Found respectively
|
302
|
+
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
303
303
|
# these new defaults that match Hotwire/Turbo behavior.
|
304
304
|
# Note: These might become the new default in future versions of Devise.
|
305
305
|
config.responder.error_status = :unprocessable_entity
|
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.9.
|
4
|
+
version: 4.9.3
|
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: 2023-
|
12
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/devise/omniauth.rb
|
152
152
|
- lib/devise/omniauth/config.rb
|
153
153
|
- lib/devise/omniauth/url_helpers.rb
|
154
|
+
- lib/devise/orm.rb
|
154
155
|
- lib/devise/orm/active_record.rb
|
155
156
|
- lib/devise/orm/mongoid.rb
|
156
157
|
- lib/devise/parameter_filter.rb
|
@@ -228,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
229
|
- !ruby/object:Gem::Version
|
229
230
|
version: '0'
|
230
231
|
requirements: []
|
231
|
-
rubygems_version: 3.4.
|
232
|
+
rubygems_version: 3.4.10
|
232
233
|
signing_key:
|
233
234
|
specification_version: 4
|
234
235
|
summary: Flexible authentication solution for Rails with Warden
|