users: log restricted signups to NewRelic.

When a new user creates an account and their account is automatically
restricted, log the reason why to NewRelic.
This commit is contained in:
evazion
2021-01-11 21:42:54 -06:00
parent ceeed1e692
commit c05868e7f1
2 changed files with 9 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ class UsersController < ApplicationController
password_confirmation: params[:user][:password_confirmation]
)
user_verifier.log! if user_verifier.requires_verification?
UserEvent.build_from_request(@user, :user_creation, request)
if params[:user][:email].present?

View File

@@ -26,6 +26,10 @@ class UserVerifier
end
end
def log!
DanbooruLogger.add_attributes("user_verifier", to_h)
end
private
def ip_address
@@ -55,5 +59,9 @@ class UserVerifier
IpLookup.new(ip_address).is_proxy?
end
def to_h
{ is_ip_banned: is_ip_banned?, is_logged_in: is_logged_in?, is_recent_signup: is_recent_signup?, is_proxy: is_proxy? }
end
memoize :is_ip_banned?, :is_proxy?, :is_recent_signup?
end