]> projects.mako.cc - selectricity-live/blobdiff - app/models/full_voter.rb
Merge from jdong
[selectricity-live] / app / models / full_voter.rb
index 980fb5cf3c0fdeef0c043be9aeabe33233f6a874..b82667c3f926f6d82f61e3844010744cc2466fdf 100644 (file)
@@ -9,4 +9,12 @@ class FullVoter < Voter
       self.password = token_generator.token
     end
   end
+  
+  protected
+  def validate
+    # E-mail regex, moderate complexity
+    # Stolen from http://www.regular-expressions.info/email.html
+    errors.add(:email, "is not valid") unless email  =~
+                  /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
+  end
 end

Benjamin Mako Hill || Want to submit a patch?