/// <summary> /// 检查确认密码和新密码是否一致 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonResult ValidateSamePwd(EditPwdViewModel model) { if (model != null && !string.IsNullOrWhiteSpace(model.NewPwd)) { if (model.NewPwd != model.RepeatPwd) { return Json("密码不一致", JsonRequestBehavior.AllowGet); } } return Json(true, JsonRequestBehavior.AllowGet); }
/// <summary> /// 检查旧密码是否正确 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonResult ValidateOldPwd(EditPwdViewModel model) { if (model != null && !string.IsNullOrWhiteSpace(model.OldPwd) && !string.IsNullOrWhiteSpace(model.Id)) { if (!UserModel.Exists("Password = @0 and ID = @1", model.OldPwd.VariationMd5(), model.Id)) { return Json("旧密码错误", JsonRequestBehavior.AllowGet); } } return Json(true, JsonRequestBehavior.AllowGet); }