Never been to DZone Snippets before?

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

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Generate random password in ruby

Aaron Blohowiak suggests adding this as a public method in user.rb:


   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
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS