Ejemplo n.º 1
0
        private bool SendSms()
        {
            IPAddress ip = IPAddressLocator.GetRequestIP(HttpContext.Current.Request);

            if (!AccountCombineService.ValidateIP(ip.ToString()))
            {
                BasePage.RegisterScript(this, "alert('同一个IP一天只有3次获取验证码的机会');");
                return(false);
            }
            var verfiCode = new VerfiCode
            {
                CellPhone = Session["phone"].ToString(),
                Code      = ChinaPay.Utility.VerifyCodeUtility.CreateVerifyCode(6),
                IP        = ip.ToString(),
                Type      = Common.Enums.VerfiCodeType.Register,
                AccountNo = Session["accountno"].ToString()
            };

            Session["phoneValidateCode"] = verfiCode.Code;
            Session["phone"]             = verfiCode.CellPhone;
            Session["phoneTime"]         = DateTime.Now;
            ChinaPay.SMS.Service.SMSSendService.SendB3bTrade(verfiCode.CellPhone, verfiCode.Code, 20, BasePage.CurrenContract.ServicePhone);
            AccountCombineService.SaveVerfiCode(verfiCode);
            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 发送短信
 /// </summary>
 public string SendSMS(string phone, string account)
 {
     try
     {
         if (!SendSMSTime())
         {
             return("请120秒后再获取验证码");
         }
         IPAddress ip = IPAddressLocator.GetRequestIP(HttpContext.Current.Request);
         if (!AccountCombineService.ValidateIP(ip.ToString()))
         {
             return("同一个IP一天只有100次获取验证码的机会");
         }
         var verfiCode = new VerfiCode()
         {
             CellPhone = phone,
             Code      = ChinaPay.Utility.VerifyCodeUtility.CreateVerifyCode(6, "1,2,3,4,5,6,7,8,9,0"),
             IP        = ip.ToString(),
             Type      = Common.Enums.VerfiCodeType.Register,
             AccountNo = account
         };
         Session["phoneValidateCode"] = verfiCode.Code;
         Session["phoneTime"]         = DateTime.Now;
         SMSSendService.SendB3bRegisterValidateCode(verfiCode.CellPhone, verfiCode.Code, 20, BasePage.CurrenContract.ServicePhone);
         AccountCombineService.SaveVerfiCode(verfiCode);
         return(string.Empty);
     }
     catch (Exception)
     {
         return("发送验证码异常");
     }
 }
Ejemplo n.º 3
0
        protected void btnNext_Click(object sender, EventArgs e)
        {
            EmployeeDetailInfo info = EmployeeService.QueryEmployee(txtAccountNo.Value);

            if (info == null)
            {
                txtAccountNoTip.InnerHtml   = "账号无效,不存在该账户";
                txtReAccountNoTip.InnerHtml = "";
                txtCodeTip.InnerHtml        = "";
                return;
            }
            if (Session["lostCode"] == null)
            {
                txtAccountNoTip.InnerHtml   = "";
                txtReAccountNoTip.InnerHtml = "";
                txtCodeTip.InnerHtml        = "验证码已过期";
                return;
            }
            if (txtCode.Value.ToUpper() != Session["lostCode"].ToString().ToUpper())
            {
                txtAccountNoTip.InnerHtml   = "";
                txtReAccountNoTip.InnerHtml = "";
                txtCodeTip.InnerHtml        = "验证码不正确";
                BasePage.RegisterScript(this, "window.onload = function(){loadValidateCode(); };");
                return;
            }

            IPAddress ip = IPAddressLocator.GetRequestIP(HttpContext.Current.Request);

            if (!AccountCombineService.ValidateIP(ip.ToString()))
            {
                txtAccountNoTip.InnerHtml   = "";
                txtReAccountNoTip.InnerHtml = "";
                txtCodeTip.InnerHtml        = "同一个IP一天只有3次获取验证码的机会";
                return;
            }
            var verfiCode = new VerfiCode()
            {
                CellPhone = info.Cellphone,
                Code      = ChinaPay.Utility.VerifyCodeUtility.CreateVerifyCode(6),
                IP        = ip.ToString(),
                Type      = Common.Enums.VerfiCodeType.Register,
                AccountNo = txtAccountNo.Value
            };

            Session["phoneValidateCode"] = verfiCode.Code;
            Session["phone"]             = verfiCode.CellPhone;
            Session["accountno"]         = verfiCode.AccountNo;
            Session["phoneTime"]         = DateTime.Now;
            ChinaPay.SMS.Service.SMSSendService.SendB3bTrade(verfiCode.CellPhone, verfiCode.Code, 20, BasePage.CurrenContract.ServicePhone);
            AccountCombineService.SaveVerfiCode(verfiCode);
            SendSMSTime();
            BasePage.RegisterScript(this, "window.location.href='RelostPasswordCode.aspx'");
        }