]> projects.mako.cc - selectricity-live/blob - app/models/full_voter.rb
980fb5cf3c0fdeef0c043be9aeabe33233f6a874
[selectricity-live] / app / models / full_voter.rb
1 class FullVoter < Voter
2   before_create :create_password
3   validates_presence_of :email, :password
4
5   def create_password
6     token_generator = UniqueTokenGenerator.new( 16 )
7     until password and not password.empty? \
8           and Voter.find(:all, :conditions => [ "password = ?", password ]).empty?
9       self.password = token_generator.token
10     end
11   end
12 end

Benjamin Mako Hill || Want to submit a patch?