You could do this quite easily by just querying the table storing reset keys for objects belonging to the user and expiring them (setting the date to the past, or setting an expire bit).
However, IMO it is far better to just generate another one, and have them expire automatically after either a set time, or after a successful password change/reset. In the case that generating a new link expires existing ones, where there is no
rate limiting, it would be theoretically possible to prevent someone resetting their password by continually requesting new links for their account.
Bri
—
Best Regards,
Brian Maher
Senior Research Software Engineer & Systems Administrator
King’s Digital Lab
VWB, 2nd Floor, Room 2.50, Strand Campus
Work: 0207 848 0511
Mobile: 07714 285086
Voip: 01702 667471