Retriving password,if users forgot password


#1

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
ideas.

N.C.Sharmila


#2

i would just create a separate db table for this. Generate some sort of
md5
hash and urlencode it into a “click here to create new password” link in
the
app.

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
the
user.

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

adam