public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                if (CustomerFacade.PhoneIsValidate(cell))
                {
                    return(Json("此手机号码已经被验证过,不能进行重复验证", JsonRequestBehavior.AllowGet));
                }
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = CurrUser.UserSysNo;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }

                if (CellPhoneSysNo == -99999)
                {
                    return(Json("同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。", JsonRequestBehavior.AllowGet));
                }
                return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult SendFindPasswordSMS(FormCollection form)
        {
            string cell = CookieHelper.GetCookie <String>("FindPasswordCustomerCellPhone");

            if (!string.IsNullOrEmpty(cell))
            {
                SMSInfo item = new SMSInfo();
                //item.CustomerSysNo = int.Parse(CookieHelper.GetCookie<String>("FindPasswordCustomerSysNo"));
                item.CreateUserSysNo = int.Parse(CookieHelper.GetCookie <String>("FindPasswordCustomerSysNo"));
                item.CellNumber      = cell;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.FindPassword;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();

                CookieHelper.SaveCookie <string>("FindPasswordSMSCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "AlertConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            //return Json("s", JsonRequestBehavior.AllowGet);
            string validatedCode = Request["ValidateCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() != validatedCode.ToLower())
            {
                return(Json(new JsonResult()
                {
                    ContentType = "验证码不正确", Data = ""
                }, JsonRequestBehavior.AllowGet));
            }


            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                //if (CustomerFacade.PhoneIsValidate(cell))
                //{
                //    return Json(new JsonResult(){ContentType="此手机号码已经被验证过,不能进行重复验证"} , JsonRequestBehavior.AllowGet);
                //}
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = 0;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "s", Data = CellPhoneSysNo
                    }, JsonRequestBehavior.AllowGet));
                }
                if (CellPhoneSysNo == -99999)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。"
                    }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new JsonResult()
                {
                    ContentType = "服务器忙,稍后重试"
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonResult()
            {
                ContentType = "服务器忙,稍后重试"
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult SendLoginValidSMS(FormCollection form)
        {
            //step one :get customer cellphone from db
            string customerID = form["CustomerID"];

            if (string.IsNullOrEmpty(customerID))
            {
                return(Json("账户名未提供,发送验证码失败。", JsonRequestBehavior.AllowGet));
            }
            var    customer          = CustomerFacade.GetCustomerByID(customerID);
            string customerCellphone = customer.CellPhone;

            //step two :send sms
            if (string.IsNullOrEmpty(customerCellphone) || customer.IsPhoneValided == 0)
            {
                return(Json("账户未绑定手机或是未完成验证绑定,获取验证码失败。", JsonRequestBehavior.AllowGet));
            }
            else
            {
                SMSInfo item = new SMSInfo();
                item.CreateUserSysNo = customer.SysNo;
                item.CellNumber      = customer.CellPhone;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.VerifyPhone;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();
                CookieHelper.SaveCookie <string>("VerifyCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "CreateConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }