예제 #1
0
 public ActionResult SetPassword(LocalPasswordModel model)
 {
     if (!ModelState.IsValid) return View(model);
     var user = _userService.GetUserById(_portalContext.CurrentUser.Id);
     if (!string.Equals(model.OldPassword.Trim(), Encrypt.GetMd5Code(user.Password)))
     {
         ModelState.AddModelError("OldPassword", "旧密码输入有误");
         return View(model);
     }
     user.Password = Encrypt.GetMd5Code(model.NewPassword.Trim());
     _userService.UpdateUser(user);
     return RedirectToAction("SetPasswordResult");
 }
예제 #2
0
 public ActionResult SetPassword()
 {
     ViewBag.userName = _portalContext.CurrentUser.Username;
     var model = new LocalPasswordModel();
     return View(model);
 }