且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过电子邮件发送临时密码来重置密码

更新时间:2023-01-09 12:18:53

在两种情况下,私有信息(临时密码或重置链接)都在同一介质上传输.从这个角度来看,安全性没有区别.但是,重置链接具有一些优点:您可以强制用户选择新密码.他这样做后,链接将立即失效并且不能被滥用.相反,临时密码往往不是您想要的那样临时.即使您强迫用户在下次登录时选择新密码,他也可能会再次输入临时密码.

In both cases, the private information (temporary password or reset link) is transmitted over the same medium. From this point of view, there's no difference in security. However, the reset link as a few advantages: You force the user to choose a new password. As soon as he does so, the link is void and cannot be abused. Temporary passwords, on the contrary, tend to be not as temporary as you like. Even if you force the user to choose a new password on the next logon, he is likely to enter the temporary one again.

此外,您可以记录使用重置链接的用户的IP,因此如有必要,至少可以将其移交给管理机构.

Additionally, you can log the IP of the one who uses the reset link, so have at least something to hand over to the authorities if necessary.