0

我正在开发一个应用程序,我应该为忘记密码的用户设计一个页面并向他们发送新密码的电子邮件。我使用的是 ASP.NET Membership,密码格式应该是散列的。

我的问题是发送邮件失败,密码已更改,哇!没有工作可以完成。

你的解决方案是什么?

4

6 回答 6

1

You should send users an email with a link, where they can confirm password reset (otherwise you could reset passwords to other users by guessing their emails). On the linked page users would then confirm password reset (or even change it themselves).

But it's a better practice not to send passwords in any way shape or form. It's the most secure.

The process

  1. Users request password reset by their email.
  2. They receive an email with a link
  3. Theyclick the link and provide a new password that gets hashed right away and stored in the system.
于 2009-07-21T16:53:32.330 回答
1

You could temporarily set the passwordFormat value for affected users to "Clear" in the aspnet_Membership table, assign them a password, and then work on getting the e-mail working.

Setting the aspnet_Membership.passwordFormat value to 0 changes the format to Clear text, which means it's not encrypted. It's not secure, but will allow login. After that, you can reset the password and it'll be changed back to 2 (Encrypted).

alt text

于 2009-07-21T16:53:38.507 回答
0

用户应该再次更改他们的密码,并希望电子邮件会成功。

如果他们输入了错误的地址,他们应该联系可以更正其电子邮件地址的管理员。

于 2009-07-21T16:46:29.787 回答
0

如果可以在您实际将更改提交到数据库之前判断电子邮件是否已成功发送,这将是一个不错的选择。情况并非总是如此,但也许它适用于您的应用程序。

通常以我的经验,如果电子邮件失败,ASP 会抛出异常。如果发生这种情况,请不要在数据库中执行任何操作,如果邮件通过则更改密码。这并不意味着他们会收到电子邮件,但无论如何您都无法解决电子邮件传输过程中出现的问题。上述选项将在此失败后应用。;)

于 2009-07-21T16:49:33.303 回答
0

我不知道asp.net 中对这种功能的支持。

但是,某些网站会向您发送一封电子邮件,其中包含一个可供点击的链接(该链接会在某些天后过期)。单击哪个,将确保您承诺执行该操作(即仅在他们收到电子邮件并单击他们收到的链接后更改密码)。

于 2009-07-21T16:50:07.033 回答
0

如果电子邮件不起作用,ASP.NET 还支持密码恢复的问题和秘密答案方法。

于 2009-07-21T16:50:15.910 回答