Module: Immunio::DeviseRecoverableHooks

Extended by:
ActiveSupport::Concern
Defined in:
lib/immunio/plugins/devise.rb

Overview

Hook into password recovery feature to trigger the ‘framework_password_reset` hook.

Instance Method Summary collapse

Instance Method Details

#send_reset_password_instructions_with_immunio(attributes = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/immunio/plugins/devise.rb', line 19

def send_reset_password_instructions_with_immunio(attributes={})
  Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
    Immunio.logger.debug { "Devise instrumentation fired for send_reset_password_instructions" }

    recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)

    if recoverable.persisted? # Found
      Immunio.password_reset user_record: recoverable, plugin: 'devise'
    else
      Immunio.failed_password_reset email: recoverable.email, plugin: 'devise'
    end

    Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
      send_reset_password_instructions_without_immunio(attributes)
    end
  end
end