Forum: Ruby on Rails Retriving password,if users forgot password

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
sharmila devi (Guest)
on 2006-05-16 14:18
(Received via mailing list)
hi rails gals and guys
   im creating authentication using username and password,i wants to
know how to retrive the username and  password,if user forgot the
username and password by asking secret question and secret answer
  e.g : what is your pet's name?

  if anyone knows how to implement tis,plz send your suggestions and

Adam D. (Guest)
on 2006-05-16 16:42
(Received via mailing list)
i would just create a separate db table for this. Generate some sort of
hash and urlencode it into a "click here to create new password" link in

when user clicks the url in the email they got,  rails matches the md5
string in the URL against an entry in the DB.  If its there, delete the
record , update user with a temp pass in the user table, and email it to

Make sure to clean up the table every few days.  IF they dont update
pass those records should be purged frequently.

This topic is locked and can not be replied to.