Generate random password in ruby
1 2 def new_random_password 3 self.password= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--")[0,6] 4 self.password_confirmation = self.password 5 end
DZone Snippets > act_as_authenticated
12730 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
1 2 def new_random_password 3 self.password= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--")[0,6] 4 self.password_confirmation = self.password 5 end