Browse Source

Improved validation (ignore 450, graylistings).

Martin Edenhofer 9 years ago
parent
commit
f534544136
1 changed files with 8 additions and 2 deletions
  1. 8 2
      app/controllers/form_controller.rb

+ 8 - 2
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