Example #1
0
        public ActionResult ChangePassword(AccountChangePasswordViewModel model)
        {
            ResponseModel response = new ResponseModel();
            if (!ModelState.IsValid)
            {
                response.Msg = ModelState.Keys.FirstOrDefault();
            }
            else
            {
                Account account = _accountService.GetById(model.AccountId);
                if (!account.LoginPwd.Equals(model.OldPwd.ToMd5String()))
                {
                    response.Msg = "旧密码与现在使用密码不一致!如需修改密码请联系客户";

                }
                else
                {
                    account.LoginPwd = model.NewPwd.ToMd5String();
                    _accountService.Update(account);
                    _unitOfWork.Commit();
                    response.Success = true;
                    response.Msg = "成功修改密码,请重新登录";
                    FormsAuthentication.SignOut();
                }
            }
            return Json(response);
        }
Example #2
0
 public ActionResult ChangePassword()
 {
     AccountChangePasswordViewModel model = new AccountChangePasswordViewModel();
     model.AccountId = LoginAccount.Id;
     return View(model);
 }