S
shapper
Hello,
I am creating a mechanism for a user to recover a password. I know two
options:
1) Generate a new random password and send it to the user by email.
Maybe not the safest way to send a password.
2) Send a url to the user for a form to change the password.
The url contains the ID of the user and a KEY.
The Key is created from various fields in the USERS table:
Username + CreatedDate + Name
When the user uses the URL I check if the Key is valid.
If it is I allow the user to change the password in a form even if
not validated.
BUT: Shouldn't this URL expire somehow?
How can I do this?
Since the Key is hashed ... I am not able to place the
date there.
Maybe I should use another approach? Encrypt? To be able to
recover the DateTime from the Key?
I think option 2 is better than option 1 or not?
Thank You,
Miguel
I am creating a mechanism for a user to recover a password. I know two
options:
1) Generate a new random password and send it to the user by email.
Maybe not the safest way to send a password.
2) Send a url to the user for a form to change the password.
The url contains the ID of the user and a KEY.
The Key is created from various fields in the USERS table:
Username + CreatedDate + Name
When the user uses the URL I check if the Key is valid.
If it is I allow the user to change the password in a form even if
not validated.
BUT: Shouldn't this URL expire somehow?
How can I do this?
Since the Key is hashed ... I am not able to place the
date there.
Maybe I should use another approach? Encrypt? To be able to
recover the DateTime from the Key?
I think option 2 is better than option 1 or not?
Thank You,
Miguel