Class: Workarea::User::RecentPassword
- Inherits:
-
Object
- Object
- Workarea::User::RecentPassword
- Includes:
- ActiveModel::SecurePassword, ApplicationDocument
- Defined in:
- app/models/workarea/user/recent_password.rb
Class Method Summary collapse
Methods included from ApplicationDocument
Methods included from Sidekiq::Callbacks
add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list
Methods included from Mongoid::Document
Class Method Details
.clean(user) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/workarea/user/recent_password.rb', line 13 def self.clean(user) limit = Workarea.config.password_history_length if user.recent_passwords.length > limit user .recent_passwords .by_newest .to_a .first(user.recent_passwords.length - limit) .each(&:delete) end end |