我有一个允许登录用户更改密码的表单。每当我在重新输入密码框中输入密码时,我都会弹出一个窗口,要求我选择要更改密码的用户!令人震惊的是,这种弹出窗口甚至会出现,因为它看起来像一个明显的安全漏洞。
我的视图代码的相关部分是
<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; }
谢谢,
萨钦