What is the best "forgot my password" method?

Posted by Edward Tanguay on Stack Overflow See other posts from Stack Overflow or by Edward Tanguay
Published on 2009-05-23T14:42:21Z Indexed on 2010/03/15 8:49 UTC
Read the original article Hit count: 430

I'm programming a community website.

I want to build a "forgot my password" feature.

Looking around at different sites, I've found they employ one of three options:

  1. send the user an email with a link to a unique, hidden URL that allows him to change his password (Gmail and Amazon)

  2. send the user an email with a new, randomly generated password (Wordpress)

  3. send the user his current password (www.teach12.com)

Option #3 seems the most convenient to the user but since I save passwords as an MD5 hash, I don't see how option #3 would be available to me since MD5 is irreversible. This also seems to be insecure option since it means that the website must be saving the password in clear text somewhere, and at the least the clear-text password is being sent over insecure e-mail to the user. Or am I missing something here?

So if I can't do option #1, option #2 seems to be the simplest to program since I just have to change the user's password and send it to him. Although this is somewhat insecure since you have to have a live password being communicated via insecure e-mail. However, this could also be misused by trouble-makers to pester users by typing in random e-mails and constantly changing passwords of various users.

Option #1 seems to be the most secure but requires a little extra programming to deal with a hidden URL that expires etc., but it seems to be what the big sites use.

What experience have you had using/programming these various options? Are there any options I've missed?

© Stack Overflow or respective owner

Related posts about md5

Related posts about application-design