More signup reporting

This commit is contained in:
Kyle Drake 2015-04-19 06:51:40 -07:00
parent eba8a307bd
commit ec4a3b4440

View file

@ -41,13 +41,24 @@ end
def require_unbanned_ip def require_unbanned_ip
if session[:banned] || Site.banned_ip?(request.ip) if session[:banned] || Site.banned_ip?(request.ip)
signout signout
session[:banned] = true session[:banned] = request.ip if !session[:banned]
flash[:error] = 'Site creation has been banned due to ToS violation/spam. '+ 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, <a href="/contact">contact the site admin</a>.' 'If you believe this to be in error, <a href="/contact">contact the site admin</a>.'
return {result: 'error'}.to_json return {result: 'error'}.to_json
end end
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 def title
out = "Neocities" out = "Neocities"
return out if request.path == '/' return out if request.path == '/'