Improved validation (ignore 450, graylistings).

This commit is contained in:
Martin Edenhofer 2016-02-01 11:28:44 +01:00
parent 6b305dd1de
commit f534544136

View file

@ -33,7 +33,7 @@ class FormController < ApplicationController
if params[:email] !~ /@/ if params[:email] !~ /@/
errors['email'] = 'invalid' errors['email'] = 'invalid'
end end
if params[:email] =~ /(>|<|\||\!|"|§|'|\$|%|&|\(|\)|\?)/ if params[:email] =~ /(>|<|\||\!|"|§|'|\$|%|&|\(|\)|\?|\s)/
errors['email'] = 'invalid' errors['email'] = 'invalid'
end end
if !params[:title] || params[:title].empty? if !params[:title] || params[:title].empty?
@ -52,7 +52,13 @@ class FormController < ApplicationController
errors['email'] = "Unable to send to '#{params[:email]}'" errors['email'] = "Unable to send to '#{params[:email]}'"
end end
rescue => e rescue => e
errors['email'] = e.to_s message = e.to_s
Rails.logger.info "Can't verify email #{params[:email]}: #{message}"
# ignore 450, graylistings
if message !~ /450/
errors['email'] = message
end
end end
end end