public ActionResult login(UserLogOnModel model) { if (!_validateCodeService.CheckCode(model.ValidCode)) { _validateCodeService.ClearSession(); return(Json(new { result = false, message = "验证码不正确" }, JsonRequestBehavior.AllowGet)); } var userInfo = _accountInfoTask.GetAccount(model.Account); if (userInfo == null) { return(Json(new { result = false, message = "用户不存在" }, JsonRequestBehavior.AllowGet)); } if (userInfo.Password != CryptTools.HashPassword(model.Password)) { return(Json(new { result = false, message = "用户名或密码不正确" }, JsonRequestBehavior.AllowGet)); } // 添加登录日志 _accountLoginLogTask.Add(new AccountLoginLog { Account = userInfo.Account, CreateDate = DateTime.Now, IP = DNTRequest.GetIP(), }); // 更新购物车 FormsAuthServiceCookie.SignIn(model.Account, false); return(Json(new { result = true, message = string.Empty }, JsonRequestBehavior.AllowGet)); }
public ActionResult Check(string validateCode) { var isOK = _validateCodeService.CheckCode(validateCode); return(Json(isOK, JsonRequestBehavior.AllowGet)); }