lib/devise/models/authenticatable.rb in devise-4.7.3 vs lib/devise/models/authenticatable.rb in devise-4.8.0
- old
+ new
@@ -1,9 +1,10 @@
# frozen_string_literal: true
require 'devise/hooks/activatable'
require 'devise/hooks/csrf_cleaner'
+require 'devise/rails/deprecated_constant_accessor'
module Devise
module Models
# Authenticatable module. Holds common settings for authentication.
#
@@ -53,15 +54,18 @@
# end
#
module Authenticatable
extend ActiveSupport::Concern
- BLACKLIST_FOR_SERIALIZATION = [:encrypted_password, :reset_password_token, :reset_password_sent_at,
+ UNSAFE_ATTRIBUTES_FOR_SERIALIZATION = [:encrypted_password, :reset_password_token, :reset_password_sent_at,
:remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip,
:last_sign_in_ip, :password_salt, :confirmation_token, :confirmed_at, :confirmation_sent_at,
:remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at]
+ include Devise::DeprecatedConstantAccessor
+ deprecate_constant "BLACKLIST_FOR_SERIALIZATION", "Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION"
+
included do
class_attribute :devise_modules, instance_writer: false
self.devise_modules ||= []
before_validation :downcase_keys
@@ -107,10 +111,10 @@
options[:except] = Array(options[:except]).dup
if options[:force_except]
options[:except].concat Array(options[:force_except])
else
- options[:except].concat BLACKLIST_FOR_SERIALIZATION
+ options[:except].concat UNSAFE_ATTRIBUTES_FOR_SERIALIZATION
end
super(options)
end