X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/a16962155a3c3c6616bfe32c7216f3631836d38c..5ccb47e8c8b3c782147b9f0ca7c45fc4dd5d034c:/app/models/full_voter.rb diff --git a/app/models/full_voter.rb b/app/models/full_voter.rb index 980fb5c..b82667c 100644 --- a/app/models/full_voter.rb +++ b/app/models/full_voter.rb @@ -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