Skip to content
Advertisement

How can I create a 10-minute valid link in codeigniter?

I make the module I forgot my password for an application. I want to send a link that will be valid for a certain period of time.
For example, this link is valid for 10 minutes and then the link will not be valid because the time has expired.

Is there a feature for this in Codeigniter?

Thank you.

Advertisement

Answer

No such feature available in Codeigniter and you have to write custom script for the same. There are multiple ways to perform this action:

  1. You can generate and store token in Database and send that token with forgot password URL. Once user hit forgot password URL, system will validate that token value like whether its exists or not in Database, expiry time etc.

Also you can delete that token once used or set a number of times user can use same token in 10 minutes (For example: If user hit forgot password URL with same time 3 times then system will allow else throw an error).

  1. Encrypt the timestamp and pass it in forgot password URL
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement