Skip to content

Instantly share code, notes, and snippets.

@lxcodes
Created June 21, 2011 13:07
Show Gist options
  • Save lxcodes/1037818 to your computer and use it in GitHub Desktop.
Save lxcodes/1037818 to your computer and use it in GitHub Desktop.
Password Reset
def password_reset
o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten;
new_pass = (0..20).map{ o[rand(o.length)] }.join;
self.update(:shahash => User.encrypt(new_pass))
return self.new_pass
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment