protected override void Execute(Hashtable Params) { switch (ActionUtil.GetCmd(Params)) { case ActionUtil.AutoRun: CBTypes.Items.Add(account_type.NormalAcount); CBTypes.Items.Add(account_type.VirtualAccount); CBTypes.Items.Add(account_type.AgentAccount); CBTypes.Items.Add(account_type.ManageAccount); CBTypes.SelectedIndex = 0; _objValidationHelper.Add(TxtAccountID); _objValidationHelper.Add(TxtPassword); _objValidationHelper.Add(TxtConfirm); _objValidationHelper.Add(CBTypes); _objValidationHelper.Add(TxtParentAgent); standardGrid1.DataMember = DictSet.TableName; standardGrid1.DataSource = MemberDBUtils.GetMemberDigest(GetControl()); _objValidationHelper.ResetAllState(false, false); _objValidationHelper.ValidateAll(); break; } base.Execute(Params); }
public static Hashtable GetAuthorizeCache(HttpRequestBase Request) { Hashtable result = null; if (Request.Cookies["__sid"] != null) { string sid = Request.Cookies["__sid"].Value; string ticket = ACachTool.PickCachTool().GetValue(sid) as string; if (!string.IsNullOrEmpty(ticket)) { // 从服务器缓存中得到seession的ticket信息 FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(ticket); if (authTicket != null && !authTicket.Expired && authTicket.UserData == Request.UserHostAddress) { Hashtable aHT = ACachTool.PickCachTool().GetValue(authTicket.Name) as Hashtable; if (aHT != null) { ParamUtil.Pick(aHT).ImportSets(MemberDBUtils.GetMemberDigest(BaseControl.GlobalControl, ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER"))); ParamUtil.Pick(aHT).SetParam("ticket", authTicket); // 缓存续期 ACachTool.PickCachTool().SetValue(sid, FormsAuthentication.Encrypt(authTicket), 30, true); ACachTool.PickCachTool().SetValue(authTicket.Name, aHT, 30, true); result = aHT; } } } } return(result); }
public JsonResult doRegister() { string flag = "success"; string message = ""; if (!string.IsNullOrEmpty(Request["vcode"])) { string strAccountId = Request["account"]; string strPassword = Request["password"]; string strAgentCode = Request["agentcode"]; if (string.IsNullOrEmpty(strAgentCode)) { strAgentCode = "000101999"; } // 是否存在? if (MemberDBUtils.MemberIsExist(GetControl(), strAccountId)) { flag = "failed"; message = "用户名已存在"; } else { Hashtable aHT = new Hashtable(); PickParam(aHT).SetParam("DOMAINUSER", strAccountId); PickParam(aHT).SetParam("DOMAINNAME", "caika.com"); PickParam(aHT).SetParam("PSTPWD", strPassword); PickParam(aHT).SetParam("TYPE", account_type.NormalAcount); PickParam(aHT).SetParam("IP", Request.UserHostAddress); PickParam(aHT).SetParam(MemberDBUtils.GetMemberDigest(GetControl())); PickParam(aHT).SetParam("PARENTAGENT", strAgentCode); // 校验应用许可权的合法性 ParamUtil checkLicense = PickParam().Merge(aHT).SetCmd(ADomain.CCheckLicense).ExecuteCmd(new ADomain()); if (!checkLicense.IsOK()) { flag = "failed"; message = checkLicense.GetError(); } else { // 先注册通行证、然后再添加会员账户 // 执行CRegister命令后会破坏aHT参数信息,所以在此创建一个临时aHT1用于避免原始参数集合不被破坏。 Hashtable aHT1 = new Hashtable(); if (PickParam(aHT1).Merge(aHT).SetCmd(APassport.CRegister).ExecuteCmd(new APassport()).IsOK()) { // 创建会员账户 Hashtable aHT2 = new Hashtable(); MemberDBUtils.CreateMemberRecord(GetControl(), PickParam(aHT2).Merge(aHT).ParamTable); if (!PickParam(aHT2).IsOK()) { flag = "failed"; message = PickParam(aHT2).GetError(); } else { // 注册完成后直接登录 if (PickParam(aHT).SetCmd(APassport.CSignOn).ExecuteCmd(new APassport()).IsOK()) { Authorizes.SetAuthorizeCache(Request, Response, PickParam(aHT).GetValue("passport") as Hashtable); } else { flag = "failed"; message = PickParam(aHT).GetError(); } } } else { flag = "failed"; message = PickParam(aHT1).GetError(); } } } } else { flag = "failed"; message = "验证码失效"; } return(Json(new { state = flag, message = message })); }