2

I am using the password recovery control in an ASP.NET MVC 2 web app. When I click the submit button without a username, it indicates the username is missing with an asterisk. If I put in an a username the form submits but nothing happens. Am I missing something here?

Web.config:

<system.net>
  <mailSettings>
    <smtp deliveryMethod="Network" from="yyy@zzz.com">
      <network host="mail.zzz.com" userName="yyy@zzz.com" 
        password="xxxxx" enableSsl="false" />               
    </smtp>
  </mailSettings>
</system.net>   

machine.config

<membership defaultProvider="MySQLMembershipProvider">
<providers>
<add name="MySQLMembershipProvider" 
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.3.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 
autogenerateschema="true"
connectionStringName="LocalMySqlServer" 
enablePasswordRetrieval="false" 
enablePasswordReset="true" 
requiresQuestionAndAnswer="false" 
applicationName="/" 
requiresUniqueEmail="true" 
passwordFormat="Hashed" 
maxInvalidPasswordAttempts="5" 
minRequiredPasswordLength="6" 
minRequiredNonalphanumericCharacters="1" 
passwordAttemptWindow="10" 
passwordStrengthRegularExpression="" />
</providers>
</membership>
4

1 回答 1

0

根据您的配置,您正在使用散列密码并禁用密码检索。这意味着您无法恢复密码(因为它们已经过哈希处理)。您只能重置它们。

这是一个安全的设置,所以不要更改它。但请注意,当密码被散列时,您无法“恢复”密码。

如果您的要求指定密码必须是可恢复的,那么您必须将 passwordFormat 更改为 Encrypted 并设置 enablePasswordRetrieval="true"。但是要知道,数据库中的任何散列密码和密码答案都需要由用户重新输入,因为就提供商而言,当前值将是“损坏的”。要强制执行此更改,您可以覆盖登录页面中的 Authenticate 方法并检查用户的 LastPasswordChange 日期,然后将他们重定向到一个页面以重新配置他们的密码和答案,以便他们可以正确登录。

最后要提到的一件事是,加密的密码是可检索的,因为它们可以被解密。这意味着它们的安全性较低。因此,如果可以的话,请坚持使用散列密码。

于 2011-03-17T21:20:37.197 回答