Skip to content

Commit

Permalink
修改密码的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuLiang authored and LiuLiang committed Jan 10, 2019
1 parent 5a7e6e2 commit 1427fb7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/WalkingTec.Mvvm.Mvc/SetupFiles/vms/ChangePasswordVM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@ namespace $vmns$.HomeVMs

[Display(Name = "当前密码")]
[Required(AllowEmptyStrings = false)]
[StringLength(50,ErrorMessage ="{0}最多输入{1}个字符")]
[StringLength(50, ErrorMessage = "{0}最多输入{1}个字符")]
public string OldPassword { get; set; }

[Display(Name = "新密码")]
[Required(AllowEmptyStrings = false)]
[StringLength(50,ErrorMessage ="{0}最多输入{1}个字符")]
[StringLength(50, ErrorMessage = "{0}最多输入{1}个字符")]
public string NewPassword { get; set; }

[Display(Name = "新密码")]
[Required(AllowEmptyStrings = false)]
[StringLength(50,ErrorMessage ="{0}最多输入{1}个字符")]
[StringLength(50, ErrorMessage = "{0}最多输入{1}个字符")]
public string NewPasswordComfirm { get; set; }

/// <summary>
/// 自定义验证函数,验证原密码是否正确,并验证两次新密码是否输入一致
/// </summary>
/// <param name="validationContext">验证环境</param>
/// <returns>验证结果</returns>
public override void Validate()
{
Expand All @@ -53,7 +52,7 @@ namespace $vmns$.HomeVMs
var user = DC.Set<FrameworkUserBase>().Where(x => x.ITCode == LoginUserInfo.ITCode).SingleOrDefault();
if (user != null)
{
user.Password = NewPassword;
user.Password = Utils.GetMD5String(NewPassword);
}
DC.SaveChanges();
}
Expand Down

0 comments on commit 1427fb7

Please sign in to comment.