无需通过电子邮件发送密码即可恢复密码
因此,我一直在使用 asp:PasswordRecovery
并发现我真的不喜欢它,原因如下:
1) 即使无法访问 Alice 的电子邮件,Alice 的密码也可以重置。 密码重置的安全问题缓解了这个问题,但并不能真正令我满意。
2) Alice 的新密码以明文形式发回给她。 我宁愿向她发送一个指向我的页面的特殊链接(例如 example.com/recovery.aspx?P=lfaj0831uefjc 之类的页面),这将让她更改密码。
我想我可以通过创建某种过期密码恢复页面表并将这些页面发送给要求重置的用户来自己完成此操作。 不知何故,这些页面还可以在幕后更改用户密码(例如,通过手动重置密码,然后使用新密码的文本来更改密码,因为在不知道旧密码的情况下无法更改密码)。 我确信其他人以前也遇到过这个问题,而且这种解决方案让我觉得有点老套。 有一个更好的方法吗?
理想的解决方案不会通过直接访问数据库来违反封装,而是使用数据库中现有的存储过程......尽管这可能是不可能的。
So, I've been playing with asp:PasswordRecovery
and discovered I really don't like it, for several reasons:
1) Alice's password can be reset even without having access to Alice's email. A security question for password resets mitigates this, but does not really satisfy me.
2) Alice's new password is sent back to her in cleartext. I would rather send her a special link to my page (e.g. a page like example.com/recovery.aspx?P=lfaj0831uefjc), which would let her change her password.
I imagine I could do this myself by creating some sort of table of expiring password recovery pages and sending those pages to users who asked for a reset. Somehow those pages could also change user passwords behind the scenes (e.g. by resetting them manually and then using the text of the new password to change the password, since a password cannot be changed without knowing the old one). I'm sure others have had this problem before and that kind of solution strikes me as a little hacky. Is there a better way to do this?
An ideal solution does not violate encapsulation by accessing the database directly but instead uses the existing stored procedures within the database...though that may not be possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我目前正在 Spring + SpringSecurity 之上实现一个开源 用户管理系统 ,这就是我解决丢失密码问题的方法。
这可以避免在电子邮件中发送密码(明文)。 它还可以防止一个人重置另一个人的密码只是为了造成麻烦,因为密码重置仅在使用链接后才会发生。
但它确实依赖于用户电子邮件帐户的安全,以及电子邮件在传输过程中不被窥探。 对于某些应用程序来说,这可能是不可接受的风险。
另一个因素是,您在更改用户的注册电子邮件地址时需要非常小心。 至少,用户必须在请求更改地址时输入当前密码……以防止通过无人值守的登录会话进行黑客攻击。
I'm currently implementing an open source user management system on top of Spring + SpringSecurity, and here's how I'm addressing the lost password problem.
This avoids sending a password (in clear) in an email message. And it also protects against one person resetting another person's password just to be a nuisance, because the password reset only takes place after the link has been used.
But it does rely on the user's email account being secure, and in the email not being snooped while in transit. For some applications, this maybe an unacceptable risk.
Another piece of the equation is that you need to be really careful about changing a user's registered email addresses. At the very least, the user must enter their current password with the request to change address ... to prevent against hacking via unattended login sessions.
我建议添加额外的检查级别,这里有一些选项可供选择。
一般来说,我完全反对在电子邮件中发送密码,因此我更喜欢密码重置链接选项,而不是新的纯文本密码。
I recommend adding an additional level of checking, here are some options to choose from.
In general I am totally against ever sending a password in Email, so I like the password reset link option more than a new plain-text password.