Best practice for resetting forgotten user passwords

老子叫甜甜 提交于 2019-11-30 05:06:44

The best pattern would be :

  1. User requests password reset. Best is to do it through username, and don't indicate if the username exists or not (to avoid possible users listing through a script)

  2. You generate a record in a new database table with userid, datetime of request (= current datetime), and a GUID you just generated

  3. You send a mail to the user, pointing to password reset page with the GUID (not the userid) as parameter

  4. On this page, you should check that the GUID is existing, and eventually you could put some expiration date (=the user has 1 day to reset, for example)

  5. Don't forget to mark the record as "used" (with an extra field in the table) when the user reset his password, so that you can stop an eventual second try...

It could possibly even more secure, but that is already quite good I think....

OWASP has a good checklist of https://www.owasp.org/index.php/Forgot_Password_Cheat_Sheet

Here is a quick summary of steps:

  1. Gather Identity Data or Security Questions
  2. Verify Security Questions
  3. Send a Token Over a Side-Channel
  4. Allow user to change password

Verify if the sender is the real user by asking verification questions.

Do not send password on the personal email that is not on the planate employees list.

Do not add the word "password" to the title or body of the email.

Make sure to send separately the username and password.

For Office 365 user, direct them to the forgot my password area or send this link https://passwordreset.microsoftonline.com

Don't get intimidated by the user, escalate to IT manager if the need arises.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!