Forum Moderators: coopster

Message Too Old, No Replies

How to erase and generate new md5 password?

for password resetting

         

ajs83

10:29 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



I have a simple registration that allows users to set their own password (which is then encrypted using md5). What I would like to do is if they forget it, allow them to reset it using a reset password form which would email them a temporary password so that they could log-in and change it to what they want.

What exactly would I have to do or (better yet) is there a script out there that would take care of this for me, if I customized it?

jezra

11:32 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



I had to do the same thing, here is how i did it. I have a basic database with the following fields:
user_id (integer)
user_active (integer)
user_name (varchar)
user_email (varchar)
user_md5_password (varchar)
user_new_password (varchar)
user_key (integer)

When a user forgets their sign in info, they are asked to enter their email address. if the email matches an active user, then the user_key is set to a random 4 digit integer and the user_new_password is set to a md5 hash of a random password. An email is then sent to the users email address containing,their sign in name, the new password, and a link that needs to be clicked in order to activate the new password. Something like
[example.com...]
when the link is clicked, the user_key is set to 0, the user_md5_password is set to user_new_password and then user_new_password is set to an empty string. I hope this helps

jezra