public ActionResult UserPass(string oldPassword, string newPassword, string confirmPassword) { if (!HttpContext.User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); //去登录 } SiteIdentity SID = new SiteIdentity(User.Identity.Name); JsonObject json = new JsonObject(); if (SID.TestPassword(oldPassword) == 0) { json.Put("Result", "Error"); return(Json(json)); } else { if (newPassword.Trim() != confirmPassword.Trim()) { json.Put("Result", "ConfirmError"); return(Json(json)); } else { YSWL.Accounts.Bus.User currentUser = CurrentUser; if (!currentUser.SetPassword(CurrentUser.UserName, newPassword, MvcApplication.IsAutoConn)) { json.Put("Result", "NO"); return(Json(json)); } else { json.Put("Result", "OK"); return(Json(json)); } } } }