Commit 445d4cc0 authored by James Lopez's avatar James Lopez

refactor password controller

parent 0f6c6b96
......@@ -2,7 +2,8 @@ class PasswordsController < Devise::PasswordsController
before_action :resource_from_email, only: [:create]
before_action :prevent_ldap_reset, only: [:create]
before_action :throttle_reset, only: [:create]
before_action :log_audit_event, only: [:create]
prepend EE::PasswordsController
def edit
super
......@@ -54,15 +55,4 @@ class PasswordsController < Devise::PasswordsController
redirect_to new_user_session_path,
notice: I18n.t('devise.passwords.send_paranoid_instructions')
end
private
def log_audit_event
AuditEventService.new(current_user,
resource,
action: :custom,
custom_message: 'Ask for password reset',
ip_address: request.remote_ip)
.for_user(resource_params[:email]).unauth_security_event
end
end
module EE
module PasswordsController
prepended do
before_action :log_audit_event, only: [:create]
end
private
def log_audit_event
AuditEventService.new(current_user,
resource,
action: :custom,
custom_message: 'Ask for password reset',
ip_address: request.remote_ip)
.for_user(resource_params[:email]).unauth_security_event
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment