Browse Source

Friendlier email validation

Andrew Kane 7 years ago
parent
commit
17e02e946a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/models/blazer/check.rb

+ 4 - 1
app/models/blazer/check.rb

@@ -73,7 +73,10 @@ module Blazer
       def fix_emails
       def fix_emails
         # some people like doing ; instead of ,
         # some people like doing ; instead of ,
         # but we know what they mean, so let's fix it
         # but we know what they mean, so let's fix it
-        self.emails = emails.gsub(";", ",") if emails.present?
+        # also, some people like to use whitespace
+        if emails.present?
+          self.emails = emails.gsub(/[;\s]/, ",").gsub(/,+/, ", ")
+        end
       end
       end
 
 
       def validate_emails
       def validate_emails