diff --git a/app_helpers.rb b/app_helpers.rb index 638f1c48..7a1ea067 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -41,13 +41,24 @@ end def require_unbanned_ip if session[:banned] || Site.banned_ip?(request.ip) signout - session[:banned] = true - flash[:error] = 'Site creation has been banned due to ToS violation/spam. '+ + session[:banned] = request.ip if !session[:banned] + send_banned_report + flash[:error] = 'Site creation has been banned due to a Terms of Service violation. '+ 'If you believe this to be in error, contact the site admin.' return {result: 'error'}.to_json end end +def send_banned_report + EmailWorker.perform_async({ + from: 'web@neocities.org', + reply_to: 'contact@neocities.org', + to: 'errors@neocities.org', + subject: "[Neocities] Ban report", + body: "IP: #{request.ip}\n\nSession: #{session.inspect}\n\nParams:#{params.inspect}" + }) +end + def title out = "Neocities" return out if request.path == '/'