From f5345441364184c736b61b7bbf21e5ca3254e4f5 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 1 Feb 2016 11:28:44 +0100 Subject: [PATCH] Improved validation (ignore 450, graylistings). --- app/controllers/form_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index c65f56fb0..a2eac78a8 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -33,7 +33,7 @@ class FormController < ApplicationController if params[:email] !~ /@/ errors['email'] = 'invalid' end - if params[:email] =~ /(>|<|\||\!|"|§|'|\$|%|&|\(|\)|\?)/ + if params[:email] =~ /(>|<|\||\!|"|§|'|\$|%|&|\(|\)|\?|\s)/ errors['email'] = 'invalid' end if !params[:title] || params[:title].empty? @@ -52,7 +52,13 @@ class FormController < ApplicationController errors['email'] = "Unable to send to '#{params[:email]}'" end 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