php - What stops someone from forging a password reset link? -


i'm creating profile system website, , i'm @ point i'm coding password reset function in php.

basically, i'm asking user email address, setting random md5 password , emailing them , comes in link formatted like

www.mysite.com/reset.php?email=myemail@myemail.com&hash=hashgoeshere

what point in hiding passwords behind md5 when forge password reset link , use hash value instead of password?

you should opt workflow like:

  • generate new guid, save against user account, call passwordresettoken
  • the email send should redirect user /reset.php?email=myemail@email.com&resettoken=xxxxxxxxxxx
  • you verify reset token exists user account specified
  • ask user enter new password of choice , save it.
  • nullify saved reset token cannot used again

it extremely/statistically unlikely guess link set someone's password chose, unless (a) reset request made account, , (b) can happen guess guid generated.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -