Improved validation (ignore 450, graylistings).
This commit is contained in:
parent
6b305dd1de
commit
f534544136
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue