public JsonResult CheckLogin(BaseUser loginuser) { JsonResult json = new JsonResult(); OperateStatus op = new OperateStatus(); string checkVerify = DEncrypt.Get16_Md5Lower(loginuser.Code, null); if (Session["Login_VerifyCode"] == null || checkVerify != Session["Login_VerifyCode"].ToString()) { op.IsSuccessful = false; op.Message = "验证码不正确,请重新输入!"; } else { op = ouDal.CheckLogin(loginuser); if (op.IsSuccessful) { //记录Cookie //UserHelper.WrriteUserTokenCookie(loginuser.LoginName); op.IsSuccessful = true; op.Message = "登录成功!欢迎您!"; //记录Cookie UserHelper.WriteUserTokenCookie(loginuser.LoginName); } else { op.IsSuccessful = false; op.Message = op.Message ?? "用户名或密码错误!"; } } json.Data = op; return(json); }
public JsonResult CheckLogin(BaseUser loginuser) { OperateStatus op = new OperateStatus { IsSuccessful = false, Message = "初始异常!" }; string checkVerify = DEncrypt.Get16_Md5Lower(loginuser.Code, null); if (HttpContext.Session.GetString("Login_VerifyCode") == null || checkVerify != HttpContext.Session.GetString("Login_VerifyCode").ToString()) { op.IsSuccessful = false; op.Message = "验证码不正确,请重新输入!"; } else { op = ouDal.CheckLogin(loginuser); if (op.IsSuccessful) { op.IsSuccessful = true; op.Message = "登录成功!欢迎您!"; //记录Cookie UserHelper.WriteUserTokenCookie(loginuser.LoginName); } else { op.IsSuccessful = false; op.Message = op.Message ?? "用户名或密码错误!"; } } return(Json(op)); }