I am implementing a password reset function and would have the key I want to use as a parameter to a jsp page(I assume that is how it’s done. How can I pass parameters and to the jsp page and make those parameters only active for a certain amount of time?
Share
Just include it in request URL.
Store a timestamp along the key in the DB when the key is generated for the first time. Retrieve the timestamp from the DB when the key is requested. If the difference with the current time is too big, invalidate it. Don’t forget to setup a background job to cleanup keys which are never used within a too long time, otherwise the DB may grow out its borders with unused keys.
Unrelated to the concrete problem, I’m not sure what project you have there, but if you can, upgrade to JSF 2.x with Facelets as soon as possible. JSP is only typical for old JSF 1.x and is deprecated since JSF 2.0 almost 2.5 years ago.