Sha256: 92da3db8baeef52fad0dd2ccb870354a50296f40fe795111c2e41b1ae78c2917
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
# Register callbacks using Devise internals. begin require "devise" rescue LoadError # rubocop:disable Lint/HandleExceptions # Ignore end if defined? Devise module Immunio # Hook into password recovery feature to trigger the `framework_password_reset` hook. module DeviseRecoverableHooks extend ActiveSupport::Concern included do alias_method_chain :send_reset_password_instructions, :immunio end 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 end end Devise::Models::Recoverable::ClassMethods.send :include, Immunio::DeviseRecoverableHooks end
Version data entries
5 entries across 5 versions & 1 rubygems