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

About this user

Mickael

« 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:


def new_random_password
  self.password= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--")[0,6]
  self.password_confirmation = self.password
end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS