Module: Devise::Models::Eventable

Extended by:
ActiveSupport::Concern
Defined in:
lib/devise/eventable/models/eventable.rb

Overview

Eventable takes care of sending events when common actions are performed in devise.

Options

Examples

Instance Method Summary collapse

Instance Method Details

#fire_events_on_model_updateObject



28
29
30
31
32
33
34
# File 'lib/devise/eventable/models/eventable.rb', line 28

def fire_events_on_model_update
  Devise.fire_event(:password_change, { record: self } ) if saved_change_to_encrypted_password?
  Devise.fire_event(:password_reset_sent, { record: self } ) if saved_change_to_reset_password_token? && !saved_change_to_encrypted_password?
  Devise.fire_event(:password_reset, { record: self } ) if saved_change_to_encrypted_password? && saved_change_to_reset_password_token? && reset_password_token.nil?
  Devise.fire_event(:account_locked, { record: self } ) if saved_change_to_locked_at? && !locked_at.nil?
  Devise.fire_event(:account_unlocked, { record: self } ) if saved_change_to_locked_at? && locked_at.nil?
end