Skip to content

Commit

Permalink
Add deprication waring if use options argument at DatabaseAuthenticat…
Browse files Browse the repository at this point in the history
…able#update_with_password,#update_without_password
  • Loading branch information
ihatov08 committed Nov 28, 2018
1 parent 3b0bc08 commit 06f03fa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/devise/models/database_authenticatable.rb
Expand Up @@ -65,6 +65,15 @@ def clean_up_passwords
# 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?
ActiveSupport::Deprecation.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

current_password = params.delete(:current_password)

if params[:password].blank?
Expand Down Expand Up @@ -98,6 +107,15 @@ def update_with_password(params, *options)
# end
#
def update_without_password(params, *options)
if options.present?
ActiveSupport::Deprecation.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

params.delete(:password)
params.delete(:password_confirmation)

Expand Down

0 comments on commit 06f03fa

Please sign in to comment.