0

我有一个允许登录用户更改密码的表单。每当我在重新输入密码框中输入密码时,我都会弹出一个窗口,要求我选择要更改密码的用户!令人震惊的是,这种弹出窗口甚至会出现,因为它看起来像一个明显的安全漏洞。

在此处输入图像描述

我的视图代码的相关部分是

 <p>
            <label for="ViewModelChangePassword_Password">
                Password</label>
            <input type="password" value="" name="ViewModelChangePassword.Password" id="ViewModelChangePassword_Password" />
        </p>
        <p>
            <label for="ViewModelChangePassword_Password1">
                Re-enter password</label>
            <input type="password" value="" name="ViewModelChangePassword.Password1" id="ViewModelChangePassword_Password1" />
        </p>

为什么会这样?作为一个单独的问题,我想要运行此验证

[Required]
[DataType(DataType.Password)]
[DisplayName("Password")]
public string Password { get; set; }

[Required]
[DataType(DataType.Password)]
[DisplayName("Re-enter Password")]
[Compare("Password", ErrorMessage = "Passwords must match")]
public string Password1 { get; set; }

谢谢,

萨钦

4

1 回答 1

1

这与 ASP.NET、MVC 或验证无关。您可能正在使用 Firefox 测试您的页面并选择了保存密码的选项。

每当您更改该站点的密码时,Firefox都会要求您选择要更改密码的用户名。

于 2012-07-05T14:47:12.807 回答