how to create forgot password page securely in php.It send message to email for verify set new password . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to create forgot password page securely in php.It send message to email for verify set new password .

9th Feb 2021, 5:12 AM
Sanjaya Patel
Sanjaya Patel - avatar
3 Answers
+ 1
It sounds like you're asking for a secure workflow for when someone forgot a password. If you're looking for an implementation in PHP, you should provide much more detail and also focus on a specific step in the process. Are you using a PHP framework? For Laravel, this could be useful for part of the feature: https://laravel.com/docs/7.x/passwords Hopefully you keep your user's email address stored in your database. Get the user to enter the email address associated with the account. Don't assist the user by saying if the account exists or not while typing it in. Also, don't provide any select-dropdown or search feature because you'll be exposing every user's private email address. Set a randomized temporary token on that user's account. Don't immediately invalidate the password because the person resetting the password hasn't proven he's the owner of the account. Also, let the temporary token expire after 24 hours or so. Email the randomized token to the email address in a link or displayed code. After clicking the link, allow the user to set a new password and confirm it. Upon confirming, update the password and clear the temporary token so no one else can use it to set any new passwords.
11th Feb 2021, 12:19 PM
Josh Greig
Josh Greig - avatar
+ 1
If you're not sure how to connect PHP with a MySQL database, you should go through a tutorial on that. Here is a good one: https://www.mysqltutorial.org/php-mysql/ There are plenty tutorials on connecting PHP with MySQL. I suggest either using PDO or mysqli functions. When you eventually get to the point of saving user accounts, passwords... remember to keep security concerns in mind. There are lots of things to improve security. For example, salt and hash the passwords instead of storing them as plain text so that a hacker or malicious team member sees the database, he can't try those passwords on other accounts from your visitors.
11th Feb 2021, 5:12 PM
Josh Greig
Josh Greig - avatar
0
I interested to know it how connects the mysqlbdatabase and how write code in program in PHP.
11th Feb 2021, 12:22 PM
Sanjaya Patel
Sanjaya Patel - avatar