Class: Maquina::UsedPassword

Inherits:
ApplicationRecord show all
Defined in:
app/models/maquina/used_password.rb

Class Method Summary collapse

Methods inherited from ApplicationRecord

searchable?

Class Method Details

.store_password_digest(user_id, password_digest) ⇒ Object



10
11
12
13
14
15
# File 'app/models/maquina/used_password.rb', line 10

def self.store_password_digest(user_id, password_digest)
  return if Maquina.configuration.password_retain_count.blank? || Maquina.configuration.password_retain_count.zero?

  Maquina::UsedPassword.where(user: user_id).order(id: :desc).offset(2).delete_all
  Maquina::UsedPassword.create(maquina_user_id: user_id, password_digest: password_digest)
end