public string Login() { string msg = string.Empty; bool loginflag = true; //验证码 string checkCode = System.Web.HttpContext.Current.Request.Params["CheckCode"]; if (!string.IsNullOrWhiteSpace(checkCode)) { if (!checkCode.Equals(Session["checkcode"].ToString(), StringComparison.CurrentCultureIgnoreCase)) { msg = "验证码不正确!"; return("{ success: false,msg:'" + msg + "'}"); } } //数据库服务器 string svrName = System.Web.HttpContext.Current.Request.Params["ServerName"]; //帐套 string account = System.Web.HttpContext.Current.Request.Params["EnterPriseName"]; //用户名 string logid = System.Web.HttpContext.Current.Request.Params["UserID"]; //密码 string pwd = System.Web.HttpContext.Current.Request.Params["UserPwd"]; if (!string.IsNullOrWhiteSpace(pwd)) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString((string)Session["private_key"]); byte[] result = rsa.Decrypt(HexStringToBytes(pwd), false); UTF8Encoding utf8encoder = new UTF8Encoding(); pwd = utf8encoder.GetString(result); } //Check(ref msg, ref loginflag, svrName, account, logid, pwd); proxy.Check(ref msg, ref loginflag, svrName, account, logid, pwd); if (loginflag) { return("{ success: true}"); } else { return("{ success: false,msg:'" + msg + "'}"); } }
public override FilterResult Filter(LoginValidationParam param) { FilterResult filterResult = new FilterResult(); string svrName = param["svrName"].ToString(); string account = param["account"].ToString(); string logid = param["logid"].ToString(); string pwd = param["pwd"].ToString(); ILoginFacade proxy = AopObjectProxy.GetObject <ILoginFacade>(new LoginFacade()); bool loginflag = true; string msg = string.Empty; proxy.Check(ref msg, ref loginflag, svrName, account, logid, pwd); filterResult.Success = loginflag; filterResult.ErrorMsg = msg; return(filterResult); }