Guest User

Untitled

a guest
Mar 17th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #####LOGIN CONTROLLER (part of it)#######
  2. def send_password_via_email
  3. unless User.find_by_email(params[:email]).nil?
  4. user = User.find_by_email(params[:email])
  5. user.hashed_password = user.object_id.to_s + rand.to_s.slice(2, rand.to_s.length)
  6. user.save!
  7. Notifier.deliver_password_recovery(user)
  8. flash[:notice] = "A new password has been sent to your e-mail."
  9. redirect_to(:action => "login")
  10. end
  11. end
Add Comment
Please, Sign In to add comment