For a website which stores passwords hashed with the password_hash php
function, I was thinking of the following way to enable users to reset their passwords, but I did not know if it caused any security breach:
- User fills form with their email/username combination
- Form retrieves this user's hashed password and sends it by email
- User fills form with their hashed password, and their new password
- Database is updated with new password
This seems to ensure that only someone with access to the account owner's email could change the password