Beispiel #1
0
 public void EditPassword(EditPasswordModel model)
 {
     var user = new NpcContext().CurrentUser;
     if (user.Pwd != Md5Utility.GetMd5HashCode(model.OldPwd.Trim()))
         throw new ArgumentException("旧密码不正确");
     if (model.NewPwd.Trim() != model.ReNewPwd.Trim())
         throw new ArgumentException("两次密码输入不正确");
     user.Pwd = Md5Utility.GetMd5HashCode(model.ReNewPwd);
     user.RecordDescription.UpdateBy(user);
     _userRepository.Save(user);
 }
Beispiel #2
0
 public ActionResult EidtPasswordPost(EditPasswordModel model)
 {
     try
     {
         _userAction.EditPassword(model);
         return RedirectToMessage("密码修改成功!");
     }
     catch (Exception exception)
     {
         return RedirectToMessage("修改密码时发生错误:" + exception.Message);
     }
 }
Beispiel #3
0
 public EditPasswordModel InitializeEditPasswordModel()
 {
     var model = new EditPasswordModel();
     model.User = new NpcContext().CurrentUser;
     return model;
 }