lib/devise-security/models/password_archivable.rb
def password_archive_included?
        return false unless max_old_passwords.positive?

        old_passwords_including_cur_change = old_passwords.reorder(created_at: :desc).limit(max_old_passwords).pluck(:encrypted_password)
        old_passwords_including_cur_change << encrypted_password_was # include most recent change in list, but don't save it yet!
        old_passwords_including_cur_change.any? do |old_password|
          # NOTE: we deliberately do not do mass assignment here so that users that
          #   rely on `protected_attributes_continued` gem can still use this extension.
          #   See issue #68
          self.class.new.tap { |object| object.encrypted_password = old_password }.valid_password?(password)
        end
      end
# validate is the password used in the past
# @return [true] if current password was used previously
# @return [false] if disabled or not previously used
validate is the password used in the past
validate is the password used in the past
def password_archive_included?
        return false unless max_old_passwords.positive?
        old_passwords_including_cur_change = old_passwords.reorder(created_at: :desc).limit(max_old_passwords).pluck(:encrypted_password)
        old_passwords_including_cur_change << encrypted_password_was 
        old_passwords_including_cur_change.any? do |old_password|
          self.class.new.tap { |object| object.encrypted_password = old_password }.valid_password?(password)
        end
      end
def password_archive_included? return false unless max_old_passwords . positive? old_passwords_including_cur_change = old_passwords . reorder ( created_at : :desc ) . limit ( max_old_passwords ) . pluck ( :encrypted_password ) old_passwords_including_cur_change << encrypted_password_was old_passwords_including_cur_change . any? do | old_password | self . class . new . tap { | object | object . encrypted_password = old_password } . valid_password? ( password ) end end
validate is the password used in the past
validate is the password used in the past
# include most recent change in list, but don't save it yet! # NOTE: we deliberately do not do mass assignment here so that users that #   rely on `protected_attributes_continued` gem can still use this extension. #   See issue #68
if current password was used previously
if current password was used previously
true
if disabled or not previously used
if disabled or not previously used
false