mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 15:47:59 -05:00
Remove deprecated options argument from update methods
They were added to support an old/deprecated feature of Rails, as the message was saying, we can now remove them from the code as well.
This commit is contained in:
@@ -84,16 +84,7 @@ module Devise
|
||||
# users to change relevant information like the e-mail without changing
|
||||
# their password). In case the password field is rejected, the confirmation
|
||||
# is also rejected as long as it is also blank.
|
||||
def update_with_password(params, *options)
|
||||
if options.present?
|
||||
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_with_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
def update_with_password(params)
|
||||
current_password = params.delete(:current_password)
|
||||
|
||||
if params[:password].blank?
|
||||
@@ -102,9 +93,9 @@ module Devise
|
||||
end
|
||||
|
||||
result = if valid_password?(current_password)
|
||||
update(params, *options)
|
||||
update(params)
|
||||
else
|
||||
assign_attributes(params, *options)
|
||||
assign_attributes(params)
|
||||
valid?
|
||||
errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
false
|
||||
@@ -121,25 +112,16 @@ module Devise
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# def update_without_password(params, *options)
|
||||
# def update_without_password(params)
|
||||
# params.delete(:email)
|
||||
# super(params)
|
||||
# end
|
||||
#
|
||||
def update_without_password(params, *options)
|
||||
if options.present?
|
||||
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_without_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
def update_without_password(params)
|
||||
params.delete(:password)
|
||||
params.delete(:password_confirmation)
|
||||
|
||||
result = update(params, *options)
|
||||
result = update(params)
|
||||
clean_up_passwords
|
||||
result
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user