如何设置发送到电子邮件的链接的到期时间? [英] How to set expiration time for a link send to Email?

查看:127
本文介绍了如何设置发送到电子邮件的链接的到期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向用户发送电子邮件链接,要求他重置密码。单击该链接会重定向到我项目中的页面。如何设置此链接的到期时间,以及如何知道此链接是否未重新使用?什么是最好的方法呢?



谢谢

I send a link as email to the users asking him to reset the password. Clicking on the link redirects to a page in my project. How can i set the expiration time for this link, and how do i know if this link is not re used again? Whats the best way to do this?

Thanks

推荐答案

我这样做的方法是一个Guid附加到链接地址的查询字符串。

它所寻址的页面访问数据库,如果存在该Guid的记录,则检查数据库中的失效日期。如果一切正常,请删除数据库行,然后执行重置操作。



有什么问题,转储行,什么都不做。
The way I do it is to have a query string with a Guid attached to the link address.
The page it addresses access the DB and if a record for that Guid exists, checks the expiry date in the DB. If all is fine, delete the DB row, and action the reset.

Anything wrong, and dump the row, do nothing.


这篇关于如何设置发送到电子邮件的链接的到期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆