Jump to content

way to confirm a "forgot password" method


rondog

Recommended Posts

Hi,

I am doing a PHP/MySQL membership system in flash and I have everything working so far. My only issue is the "forgot password" part. It works, but the way I currently have it set up, any user that does it can change any users password. What happens is they click "forgot password." They are then prompted to enter their Username. Whatever email that username is tied to, it sends a confirmation message to their inbox with a link that looks like:

http://website.com/setpw.php?username=rondog&newpass=d520b951e2c7890e3ca6d2cf76cc4sg1

 

which then uses the get method and sets the new password whos equal to that username.

 

so if the user sees that string, potentially they can change the username= to a different user and have access to that users account. I dont know how to hide that username. The reason I am doing it this way, is I have no way of knowing which user it is.

 

I thought of one way and that would be keeping an MD5'ed version of their username in the DB as well, but any PHP developer would know how to MD5 someone's username and just put that in.

 

So I guess my question is what would be a secure way of going about this?

Link to comment
Share on other sites

But I still wont know which user to change. But making a confirmation ID gave me another idea. I'll have a field called confKey in MySQL that when they register it created a random 10letter&digit key that doesnt get used until they change their password. Then in my UPDATE clause I can do WHERE confKey = '$confKey' and then I will generate a new confKey and update the key. I think that will work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.