public String selEmail() { StringBuilder ResponseMsg = new StringBuilder(); string msg = ""; string Email = HttpUtility.HtmlDecode(Request["email"].ToString()); string CustId = HttpUtility.HtmlDecode(Request["custid"].ToString()); string ReturnUrl = HttpUtility.HtmlDecode(Request["returnUrl"].ToString()); string Spid = HttpUtility.HtmlDecode(Request["SPID"].ToString()); k = SetMail.EmailSel(CustId, Email, Spid, out msg); // 查看该邮箱是否已经被别人注册 k =0 代表此邮箱尚未被用 if (k == 0) { string a = CommonBizRules.EncryptEmailURlV2(Spid, CustId, Email, ReturnUrl, HttpContext.Current); //这里跟老版本不一样的地方是加了返回地址 string url = "点击完成认证:<a href='" + a + "'>" + a + "</a>"; Random random = new Random(); string AuthenCode = random.Next(111111, 999999).ToString(); y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg); //Response.Write(y); ResponseMsg.Append("[{"); ResponseMsg.AppendFormat("\"result\":\"{0}\",", "true"); ResponseMsg.AppendFormat("\"info\":\"{0}\"", y); ResponseMsg.Append("}]"); return(ResponseMsg.ToString()); } else { //Response.Write(msg); ResponseMsg.Append("[{"); ResponseMsg.AppendFormat("\"result\":\"{0}\",", "false"); ResponseMsg.AppendFormat("\"info\":\"{0}\"", msg); ResponseMsg.Append("}]"); return(ResponseMsg.ToString()); } }
public int EmailAuth() { string ErrMsg = ""; Result = SetMail.EmailSel("", Mail, SPID, out ErrMsg); //Result = 1; return(Result); }
public void selEmail() { string msg = ""; string Email = HttpUtility.HtmlDecode(Request.QueryString["email"].ToString()); string CustId = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString()); string Spid = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString()); string Pwd = HttpUtility.HtmlDecode(Request.QueryString["pwd"].ToString()); string webpwd = CryptographyUtil.Encrypt(Pwd); int i = FindPwd.SelState(CustId, webpwd, out msg); if (!ValidateValidateCode()) { Response.Write("验证码错误,请重新输入"); return; } else { if (i != 0) { Response.Write("登录密码输入错误,请重新输入"); return; } else { k = SetMail.EmailSel(CustId, Email, Spid, out msg); if (k == 0) { string a = CommonBizRules.EncryptEmailURl(CustId, Email, HttpContext.Current); string url = "点击完成认证:<a href='" + a + "'>" + a + "</a>"; Random random = new Random(); string AuthenCode = random.Next(111111, 999999).ToString(); y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg); Response.Write(y); } else { Response.Write(msg); } } } }
protected void btn_OK_Click(object sender, EventArgs e) { if (CertificateType.Value != "") { certno.Style.Value = "display:block"; certnoL.Style.Value = "display:block"; } else { certno.Style.Value = "display:none"; certnoL.Style.Value = "display:none"; } this.areaInfoList.Value = resulttxt.Value.ToString(); SPID = Request["SPID"] == null ? ConstHelper.DefaultInstance.BesttoneSPID : HttpUtility.HtmlDecode(Request["SPID"]); ReturnUrl = Request["ReturnUrl"] == null ? ConstHelper.DefaultInstance.BesttoneLoginPage : HttpUtility.HtmlDecode(Request["ReturnUrl"]); string username = Request.Form["username"].ToString().Trim(); string fullname = Request.Form["fullname"].ToString().Trim(); string password = Request.Form["password"].ToString().Trim(); if (CommonUtility.IsEmpty(password)) { err_password.InnerHtml = "密码不能为空格"; return; } string telephone = Request.Form["telephone"].ToString().Trim(); string phonecode = Request.Form["phone_code"].ToString().Trim(); if (ViewState["phonestate"] == null) { ViewState["phonestate"] = Request.Form["phonestate"].ToString(); string a = (string)ViewState["phonestate"]; } string email = Request.Form["email"].ToString().Trim(); string NickName = Request.Form["NickName"].ToString(); string CertificateType1 = Request.Form["CertificateType"].ToString(); string certnoS = Request.Form["certno"].ToString().Trim(); string sex = Request.Form["sex"].ToString(); string birthday = Request.Form["birthday"].ToString().Trim(); string EduLevel = Request.Form["EduLevel"].ToString().Trim(); string IncomeLevel = Request.Form["IncomeLevel"].ToString(); string Province = stext.Value.ToString(); string Area = resulttxt.Value.ToString(); string ErrMsg = ""; int Result; //判断用户名是否存在 if (CustBasicInfo.IsExistUser(username) != 0) { err_username.InnerHtml = "该用户名已经存在"; return; } if (((string)ViewState["phonestate"]).Equals("0")) { //判断手机验证码 Result = PhoneBO.SelSendSMSMassage("", telephone, phonecode, out ErrMsg); if (Result != 0) { err_phone_code.InnerHtml = "手机验证码错误,请重新输入"; return; } //判断页面验证码 if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(Request.Form["page_code"].ToString().Trim().ToUpper()), this.Context)) { err_page_code.InnerHtml = "页面验证码错误,请重新输入"; return; } } //当为认证邮箱时,判断是否已经被绑定 if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email)) { Result = SetMail.EmailSel("", email, SPID, out ErrMsg); if (Result != 0) { err_email.InnerHtml = "该邮箱已经被其他用户绑定"; return; } emailstate = "0"; } TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Result = UserRegistry.getUserRegistryWeb(SPID, username, fullname, password, telephone, (string)ViewState["phonestate"], email, emailstate, NickName, CertificateType1, certnoS, sex, birthday, EduLevel, IncomeLevel, Province, Area, out CustID, out ErrMsg); if (Result != 0) { //跳转至错误页面 if (Result == -30002) { Err_certno.InnerHtml = ErrMsg; } else { CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context); } return; } SPInfoManager spInfo = new SPInfoManager(); Object SPData = spInfo.GetSPData(this.Context, "SPData"); string key = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData); string Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key); string temp = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key); string RegistryResponseValue = HttpUtility.UrlEncode(temp); //给用户写cookie UserToken UT = new UserToken(); string key2 = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData); string UserTokenValue = UT.GenerateUserToken(CustID, fullname, username, NickName, "", "42", username, "1", key2, out ErrMsg); string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"]; PageUtility.SetCookie(UserTokenValue, CookieName, this.Page); //给客户认证邮箱发EMAIL string m = CommonBizRules.EncryptEmailURl(CustID, email, this.Context); string url = "点击完成认证:<a href='" + m + "'>" + m + "</a>"; if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email)) { DateTime datetime = DateTime.Now; SetMail.InsertEmailSendMassage(CustID, "1", url, "", 1, email, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg); } //通知积分平台 CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg); //记登录日志 CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg); //跳转至成功页面 if (ReturnUrl.IndexOf("?") > 0) { CommonBizRules.SuccessRedirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context); } else { CommonBizRules.SuccessRedirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context); } }
public String selEmail() { StringBuilder ResponseMsg = new StringBuilder(); string msg = ""; string Email = HttpUtility.HtmlDecode(Request["Email"].ToString()); string CustId = HttpUtility.HtmlDecode(Request["CustID"].ToString()); string Spid = HttpUtility.HtmlDecode(Request["SPID"].ToString()); wt = Request["wt"]; #region if (CommonUtility.IsEmpty(Spid)) { // 返回错误信息 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } if (CommonUtility.IsEmpty(Email)) { // 返回错误信息 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Email不能为空!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Email不能为空!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } if (CommonUtility.IsEmpty(CustId)) { // 返回错误信息 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } #endregion k = SetMail.EmailSel(CustId, Email, Spid, out msg); // 查看该邮箱是否已经被别人注册 k =0 代表此邮箱尚未被用 if (k == 0) { string a = CommonBizRules.EncryptEmailWithNoReturnUrl(Spid, CustId, Email, HttpContext.Current); string url = "点击完成认证:<a href='" + a + "'>" + a + "</a>"; Random random = new Random(); string AuthenCode = random.Next(111111, 999999).ToString(); y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg); ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", y); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", y); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", msg); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } else { // 邮箱已经被注册掉 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", k); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", k); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", msg); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } }
/// <summary> /// 通过邮箱找回密码 /// </summary> /// <param name="context"></param> /// <returns></returns> public String FindPwdByEmail(String SPID, String Email) { StringBuilder ResponseMsg = new StringBuilder(); Int32 Result = ErrorDefinition.BT_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg; String CustID = String.Empty; if (CommonUtility.IsEmpty(SPID)) { // 返回错误信息 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } if (CommonUtility.IsEmpty(Email)) { // 返回错误信息 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Email不能为空!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Email不能为空!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } try { Result = SetMail.EmailSel(Email, out CustID, out ErrMsg); if (Result != 0) { ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "认证邮箱有误!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "认证邮箱有误!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } else { string encryptPwd = ""; string Pwd = ""; Result = FindPwd.SelPwdByEmailV2(Email, out encryptPwd, out ErrMsg); if (Result == 0) { Pwd = CryptographyUtil.Decrypt(encryptPwd); Result = SetMail.InsertEmailSendMassage(CustID, "2", "您的密码是:" + Pwd, "", 1, Email, DateTime.Now, "找回密码", "中国电信号码百事通:找回密码", 0, out ErrMsg); if (Result == 0) { ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "邮件发送成功!"); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "邮件发送成功!"); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } else { ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-930"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-930"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } } else { //密码找回失败 ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-940"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-940"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } } } catch (Exception exp) { ResponseMsg.Length = 0; if ("json".Equals(wt)) { ResponseMsg.Append("{"); ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-950"); ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString()); ResponseMsg.Append("}"); } else { ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); ResponseMsg.Append("<PayPlatRequestParameter>"); ResponseMsg.Append("<PARAMETERS>"); ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-950"); ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString()); ResponseMsg.Append("</PARAMETERS>"); ResponseMsg.Append("</PayPlatRequestParameter>"); } return(ResponseMsg.ToString()); } return(ResponseMsg.ToString()); }