Example #1
0
 /// <summary>
 /// 错误处理
 /// </summary>
 private void ErrorHappened()
 {
     //如果允许跳转则跳转,否则不处理
     if (isRedircet)
     {
         CommonBizRules.ErrorHappenedRedircet(result, errMsg, "您尚未登录,请登录", this.Context);
     }
 }
Example #2
0
    protected void sendTicket2UA(string url)
    {
        int    Result = ErrorDefinition.IError_Result_UnknowError_Code;
        string Url    = "";

        try
        {
            string Ticket = CommonBizRules.CreateTicket();
            //string sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            //Random r = new Random();
            //Ticket = sDate + r.Next(10000, 99999).ToString();

            string SPID            = "35999999";
            string CustID          = TokenValidate.CustID;
            string RealName        = TokenValidate.RealName;
            string NickName        = TokenValidate.NickName;
            string UserName        = TokenValidate.UserName;
            string OutID           = TokenValidate.OuterID;
            string LoginAuthenName = TokenValidate.LoginAuthenName;
            string LoginAuthenType = TokenValidate.LoginAuthenType;

            String er = "";

            Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, NickName, UserName, OutID, "", LoginAuthenName, LoginAuthenType, out er);

            if (Result != 0)
            {
                return;
            }


            if (url.IndexOf("?") > 0)
            {
                Url = url + "&UATicket=" + Ticket;
            }
            else
            {
                Url = url + "?UATicket=" + Ticket;
            }



            if (url == "")
            {
                Response.Redirect("http://www.118114.cn/");
            }
            else
            {
                Response.Redirect(Url, false);
            }
        }

        catch (Exception e)
        {
            return;
        }
    }
Example #3
0
    protected void register_Click(object sender, EventArgs e)
    {
        string mobile    = this.mobile.Text;
        string checkCode = this.checkCode.Text;
        string password  = this.password.Text;
        string password2 = this.password2.Text;

        //判断手机验证码
        if (checkCode != null && !"".Equals(checkCode))
        {
            Result = PhoneBO.SelSendSMSMassage("", mobile, checkCode, out ErrMsg);
            if (Result != 0)
            {
                errorHint.InnerHtml = "手机验证码错误,请重新输入";
                return;
            }
        }

        Result = UserRegistry.quickUserRegistryWeb(SPID, password, mobile, "2", out CustID, out ErrMsg);
        if (Result != 0)
        {
            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);

        log(String.Format("key:{0},Digest:{1},temp:{2},RegistryResponseValue:{3}", key, Digest, temp, RegistryResponseValue));
        //给用户写cookie
        UserToken UT   = new UserToken();
        string    key2 = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);

        string RealName = mobile;
        string UserName = mobile;
        string NickName = mobile;

        //                                           CustID, RealName, UserName, NickName, OuterID, CustType, string LoginAuthenName, string LoginAuthenType,string key, out string ErrMsg
        string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key2, out ErrMsg);
        string CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

        //通知积分平台
        CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
        //记登录日志
        CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);

        Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, true);
    }
    protected void SendEmail(string CustID, string Mail)
    {
        DateTime datetime = DateTime.Now;
        string   ErrMsg   = "";

        //给客户认证邮箱发EMAIL
        string m   = CommonBizRules.EncryptEmailURl(CustID, Mail, this.Context);
        string url = "<a href='" + m + "'>" + m + "</a>";

        SetMail.InsertEmailSendMassage(CustID, "1", url, "", 1, Mail, datetime, "", "中国电信号码百事通:激活邮箱;尊敬的用户,点击此链接激活您的帐号", 0, out ErrMsg);
    }
Example #5
0
    protected void urlRedirectButton_ServerClick(object sender, EventArgs e)
    {
        string returnurl = "";

        if (Request.QueryString["ReturnUrl"] != null)
        {
            returnurl = Request.QueryString["ReturnUrl"].ToString();
        }
        string Phone = this.verifyMobile.Value;

        CommonBizRules.SuccessRedirect(returnurl, "您已成功设置手机", HttpContext.Current);
    }
Example #6
0
    /// <summary>
    ///
    /// </summary>
    public void SendCode()
    {
        DateTime datetime = DateTime.Now;
        string   ErrMsg   = "";

        //给客户认证邮箱发EMAIL
        string m   = CommonBizRules.EncryptEmailURl("", Mail, this.Context);
        string url = "点击完成认证:<a href='" + m + "'>" + m + "</a>";

        SetMail.InsertEmailSendMassage("", "1", url, "", 1, Mail, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
        //SetMail.InsertEmailSendMassage("", "1", "请点击下面链接", "", 0, Mail, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
    }
Example #7
0
    protected void urlRedirectButton_ServerClick(object sender, EventArgs e)
    {
        string spid      = this.spidtxt.Value;
        string ReturnUrl = null;

        if (Request.QueryString["ReturnUrl"] != null)
        {
            ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
        }

        CommonBizRules.SuccessRedirect(ReturnUrl, "设置客户信息成功", HttpContext.Current);
    }
Example #8
0
    protected void ssoFunc()
    {
        string Url = "";

        try
        {
            //生成ticket
            //string sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            //Random r = new Random();
            //string Ticket = sDate + r.Next(10000, 99999).ToString();
            string Ticket = CommonBizRules.CreateTicket();

            string CustID          = TokenValidate.CustID;
            string RealName        = TokenValidate.RealName;
            string NickName        = TokenValidate.NickName;
            string UserName        = TokenValidate.UserName;
            string OutID           = TokenValidate.OuterID;
            string LoginAuthenName = TokenValidate.LoginAuthenName;
            string LoginAuthenType = TokenValidate.LoginAuthenType;

            String er = "";

            Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, NickName, UserName, OutID, "", LoginAuthenName, LoginAuthenType, out er);

            if (Result != 0)
            {
                err_code.InnerHtml = er;
                return;
            }

            if (ReturnURL.IndexOf("?") > 0)
            {
                Url = ReturnURL + "&Ticket=" + Ticket;
            }
            else
            {
                Url = ReturnURL + "?Ticket=" + Ticket;
            }

            if (CommonUtility.IsParameterExist("NeedLogin", this.Page))
            {
                Url = Url + "&NeedLogin="******"NeedLogin"];
            }

            Response.Redirect(Url);
        }

        catch (Exception e)
        {
            err_code.InnerHtml = e.Message + ">>ReturnURL:" + Url;
        }
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        try
        {
            strLog.Append("1.开始解析SPTokenRequest\r\n");
            ParseSPTokenRequest();
            strLog.Append("2.解析SPTokenRequest结束\r\n");
            strLog.Append("3.校验全局Token\r\n");
            this.TokenValidate.IsRedircet = false;
            this.TokenValidate.Validate();
            strLog.Append("4.校验全局Token结束\r\n");
            //log("TokenValidate:" + TokenValidate.Result+"\r\n");
            if (TokenValidate.Result == 0)
            {
                strLog.Append("全局token存在\r\n");
                this.ssoFunc();
            }
            else
            {
                strLog.Append("全局token不存在\r\n");

                string Ticket = "179000179000";
                string Url    = "";

                if (ReturnURL.IndexOf("?") > 0)
                {
                    strLog.Append("ReturnUrl包含问号\r\n");
                    Url = ReturnURL + "&Ticket=" + Ticket;
                }
                else
                {
                    strLog.Append("ReturnUrl不包含问号\r\n");
                    Url = ReturnURL + "?Ticket=" + Ticket;
                }
                strLog.Append("重定向\r\n");
                Response.Redirect(Url, false);
            }
        }
        catch (System.Exception ex)
        {
            strLog.Append(ex.ToString());
            CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg + "异常信息:" + ex.ToString(), "您尚未登录,请登录", this.Context);
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Example #10
0
    protected void ssoFunc()
    {
        string Url = "";

        try
        {
            string Ticket = CommonBizRules.CreateTicket();

            string CustID   = TokenValidate.CustID;
            string RealName = TokenValidate.RealName;
            string NickName = TokenValidate.NickName;
            string UserName = TokenValidate.UserName;
            string OutID    = TokenValidate.OuterID;
            OutID = "99999";
            string LoginAuthenName = TokenValidate.LoginAuthenName;
            string LoginAuthenType = TokenValidate.LoginAuthenType;
            log(String.Format("ssoFunc: TokenValidate.RealName:{0},TokenValidate.NickName:{1},TokenValidate.UserName:{2},TokenValidate.LoginAuthenName:{3},TokenValidate.LoginAuthenType:{4}",
                              TokenValidate.RealName, TokenValidate.NickName, TokenValidate.UserName, TokenValidate.LoginAuthenName, TokenValidate.LoginAuthenType));
            String er = "";
            Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, UserName, NickName, OutID, "", LoginAuthenName, LoginAuthenType, out er);

            if (Result != 0)
            {
                errorHint.InnerHtml = er;
                return;
            }

            if (ReturnURL.IndexOf("?") > 0)
            {
                Url = ReturnURL + "&Ticket=" + Ticket;
            }
            else
            {
                Url = ReturnURL + "?Ticket=" + Ticket;
            }

            if (CommonUtility.IsParameterExist("NeedLogin", this.Page))
            {
                Url = Url + "&NeedLogin="******"NeedLogin"];
            }
            Response.AddHeader("P3P", "CP=CAO PSA OUR");
            Response.Redirect(Url, false);
        }

        catch (Exception e)
        {
            errorHint.InnerHtml = e.Message + ">>ReturnURL:" + Url;
        }
    }
Example #11
0
    public void findpwd()
    {
        List <string> list    = new List <string>();
        string        massage = null;
        int           type    = Convert.ToInt32(HttpUtility.HtmlDecode(Request.QueryString["type"].ToString()));
        string        phone   = HttpUtility.HtmlDecode(Request.QueryString["phone"].ToString());
        string        SPID    = HttpUtility.HtmlDecode(Request.QueryString["spid"].ToString());
        string        IP      = HttpUtility.HtmlDecode(Request.QueryString["ip"].ToString());


        if (!ValidateValidateCode())
        {
            Response.Write("验证码错误,请重新输入");
            return;
        }
        else
        {
            list = FindPwd.SelTypeFindPassWord(type, phone, out Msg);
            if (list[0].ToString() == "-30009")
            {
                Response.Write("voicePassword.aspx");
                return;
            }

            if (list[0].ToString() == "0")
            {
                string y = list[2].ToString();
                if (type == 1)
                {
                    massage = "您的语音密码为:" + y;
                    return;
                }
                else if (type == 2)
                {
                    massage = "您的Web密码为:" + y;
                }
                FindPwd.InsertFindPwdLog(list[1].ToString(), list[3].ToString(), Convert.ToString(type), "2", phone, 0, SPID, IP, "...", out Msg);
                //CommonBizRules.SendMessage(phone, massage, SPID);
                CommonBizRules.SendMessageV3(phone, massage, SPID);
                Response.Write("0");
            }
            else
            {
                Response.Write(list[4].ToString());
            }
        }
    }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            TokenValidate.Validate();
            if (CommonBizRules.IsUrlParams(HttpContext.Current.Request.Url.OriginalString))
            {
                if (Request.QueryString["SPID"] != null)
                {
                    SPID = Request.QueryString["SPID"].ToString();
                    //  ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
                }
                else
                {
                    SPID = "35000000";
                }
                //SPID = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
                //ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
            }

            CustID = TokenValidate.CustID;
            string UserAccount = "";

            try
            {
                string ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
                PageUtility.SetCookie(ReturnUrl, "ReferrerUrl", this.Page);
                //string url = Page.Request.UrlReferrer.ToString();5
                //PageUtility.SetCookie(url, "ReferrerUrl", this.Page);
            }
            catch (System.Exception ex)
            { }
            int Result = CustBasicInfo.GetUserAccount(CustID, out UserAccount, out ErrMsg);
            if (Result == 0)
            {
                //判断此人时候有商旅卡号!
                this.Label1.Text    = "您已经申请过商旅卡了,你的商旅卡号为:" + UserAccount;
                this.Label1.Visible = true;
                btnlogin2.Visible   = true;
            }
            else
            {
                Response.Redirect("bizCard2.aspx?id=6&SPID=" + SPID);
            }
        }
    }
Example #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string        CustID = null;
            string        Email  = null;
            string        url    = Request.Url.AbsoluteUri;
            List <string> list   = new List <string>();
            list   = CommonBizRules.DecryptEmailURL(url, HttpContext.Current);
            CustID = list[0];
            Email  = list[1];

            int i = SetMail.SelSendEmailMassage(CustID, Email, out Msg);
            if (i == 0)
            {
                CommonBizRules.SuccessRedirect("", "认证邮箱设置成功", this.Context);
            }
        }
    }
Example #14
0
    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);
                }
            }
        }
    }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        error.InnerHtml    = "";
        err_code.InnerHtml = "";
        TokenValidate.Validate();
        CustID = TokenValidate.CustID;

        if (!Page.IsPostBack)
        {
            //this.CustID = "117663768";

            btn_OK.Attributes.Add("onclick", "return CheckInput('1')");
            if (CommonBizRules.IsUrlParams(HttpContext.Current.Request.Url.OriginalString))
            {
                SPID      = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
                ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
            }
        }
    }
    public void SendCode()
    {
        int    ajaxcode = -1;
        string SPID     = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());

        if (String.IsNullOrEmpty(SPID))
        {
            return;
        }
        String ErrorDescription = "";

        int count = Convert.ToInt32(HttpUtility.HtmlDecode(Request.QueryString["count"].ToString())); // 发送次数
        //int Result = CommonBizRules.SPInterfaceGrant(SPID, "SendSMSCode", this.Context, out ErrorDescription);
        int Result = PhoneBO.SPInterfaceGrant(SPID, "SendSMSCode", out ErrorDescription);

        if (Result != 0)
        {
            return;
        }
        Random   random     = new Random();
        string   AuthenCode = random.Next(111111, 999999).ToString();
        string   PhoneNum   = HttpUtility.HtmlDecode(Request.QueryString["PhoneNum"].ToString());
        string   msg        = "";
        DateTime DealTime   = DateTime.Now;

        //Result = PhoneBO.PhoneSel(CustID, Phone, out ErrMsg);    // 验证电话是否可以做认证电话(这里的电话包括手机和电话)


        k = PhoneBO.PhoneSel("", PhoneNum, out msg);    // 验证电话是否可以做认证电话(这里的电话包括手机和电话)
        if (k == 0)
        {
            CommonBizRules.SendMessageV3(PhoneNum, "欢迎注册号码百事通会员,验证码为" + AuthenCode + ",有效期2分钟。", SPID);
            Result = PhoneBO.InsertPhoneSendMassage("", "欢迎注册号码百事通会员,验证码为" + AuthenCode + ",有效期2分钟。", AuthenCode, PhoneNum, DateTime.Now, "", count, 0, "1", out msg);
            logger.Info(PhoneNum + "<->" + AuthenCode);
            Response.Write(k);
        }
        else
        {
            logger.Info(PhoneNum + ":" + msg);
            Response.Write(k);
        }
    }
Example #17
0
    protected void ssoFunc()
    {
        string Url = "";

        try
        {
            string Ticket = CommonBizRules.CreateTicket();

            string CustID          = TokenValidate.CustID;
            string RealName        = TokenValidate.RealName;
            string NickName        = TokenValidate.NickName;
            string UserName        = TokenValidate.UserName;
            string OutID           = TokenValidate.OuterID;
            string LoginAuthenName = TokenValidate.LoginAuthenName;
            string LoginAuthenType = TokenValidate.LoginAuthenType;
            log(String.Format("ssoFunc: TokenValidate.RealName:{0},TokenValidate.NickName:{1},TokenValidate.UserName:{2},TokenValidate.LoginAuthenName:{3},TokenValidate.LoginAuthenType:{4}", TokenValidate.RealName, TokenValidate.NickName, TokenValidate.UserName, TokenValidate.LoginAuthenName, TokenValidate.LoginAuthenType));
            String er = "";
            Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, UserName, NickName, OutID, "", LoginAuthenName, LoginAuthenType, out er);

            if (Result != 0)
            {
                Response.Redirect(ReturnURL, false);
                //return;
            }

            if (ReturnURL.IndexOf("?") > 0)
            {
                Url = ReturnURL + "&Ticket=" + Ticket;
            }
            else
            {
                Url = ReturnURL + "?Ticket=" + Ticket;
            }
            Response.Redirect(Url, false);
        }

        catch (Exception e)
        {
            log(e.ToString());
        }
    }
Example #18
0
    /// <summary>
    /// 作者:赵锐
    /// 日期:2009年8月15日
    /// </summary>
    public void selMobile()
    {
        string custid = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString());
        string mnum   = HttpUtility.HtmlDecode(Request.QueryString["mnum"].ToString());
        string spid   = HttpUtility.HtmlDecode(Request.QueryString["spid"].ToString());
        int    count  = Convert.ToInt32(HttpUtility.HtmlDecode(Request.QueryString["count"].ToString()));

        k = PhoneBO.PhoneSel(custid, mnum, out msg);
        if (k == 0)
        {
            Random random     = new Random();
            string AuthenCode = random.Next(111111, 999999).ToString();
            //CommonBizRules.SendMessage(mnum, "您的验证码是:"+AuthenCode, spid);
            CommonBizRules.SendMessageV3(mnum, "您在设置认证手机,验证码是:" + AuthenCode, spid);
            int y = PhoneBO.InsertPhoneSendMassage(custid, "您在设置认证手机,验证码信息内容", AuthenCode, mnum, DateTime.Now, "描述未知", count, 0, "1", out msg);
            Response.Write(y);
        }
        else
        {
            Response.Write(msg);
        }
    }
Example #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string Ticket = CommonBizRules.CreateTicket();

        //string sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff");
        //Random r = new Random();
        //Ticket = sDate + r.Next(10000, 99999).ToString();
        Response.Write(Ticket);
        return;

        // Result.Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, Result.CustID, RealName, NickName, UserName, outerid, Result.ErrorDescription, AuthenName, AuthenType, out Result.ErrorDescription);
        //string dd= CommonBizRules.GetSPOuterIDBySPID("35000001", this.Context);

        string dd = CommonBizRules.GetReginCodeByProvinceID("02", this.Context);
        //ProvinceInfoManager proInfo = new ProvinceInfoManager();
        //object ProData = proInfo.GetProvinceData(this.Context);
        //ProvinceData ds = (ProvinceData)ProData;

        //PhoneAreaInfoManager areaInfo = new PhoneAreaInfoManager();
        //object areaData = areaInfo.GetPhoneAreaData(this.Context);
        //PhoneAreaData pad = (PhoneAreaData)areaData;
    }
Example #20
0
 /// <summary>
 /// author lihongtu
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string SPID   = null;
         string CustID = null;
         string Email  = null;
         //string ReturnUrl = null;
         string        url  = Request.Url.AbsoluteUri; //  这个就是邮箱中用户点的那串完整的链接
         List <string> list = new List <string>();
         //String Digest = CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + Email + "$" + ReturnUrl + "$" + timeTamp, key);
         //String AuthenStrValue = CryptographyUtil.ToBase64String(Encoding.UTF8.GetBytes(CryptographyUtil.Encrypt(SPID + "$" + CustID + "$" +
         //    Email + "$" + ReturnUrl + "$" + timeTamp + "$" + Digest)));
         //list = CommonBizRules.DecryptEmailURLV2(SPID, url, HttpContext.Current);
         list   = CommonBizRules.DecryptEmailWithNoReturnUrl(SPID, url, HttpContext.Current);
         SPID   = list[0];
         CustID = list[1];
         Email  = list[2];
         //ReturnUrl = list[3];
         int           i           = SetMail.SelSendEmailMassage(CustID, Email, out Msg); // update custinfo set email=@Email,emailclass='2' where custid=@CustID
         StringBuilder ResponseMsg = new StringBuilder();
         if (i == 0)
         {
             //CommonBizRules.SuccessRedirect(ReturnUrl, "认证邮箱设置成功", this.Context);
             ResponseMsg.Length = 0;
             ResponseMsg.Append("<script type='text/javascript'>");
             ResponseMsg.AppendFormat("alert('{0}');", Msg);
             ResponseMsg.Append("</script>");
         }
         else
         {
             ResponseMsg.Length = 0;
             ResponseMsg.Append("<script type='text/javascript'>");
             ResponseMsg.AppendFormat("alert('{0}');", Msg);
             ResponseMsg.Append("</script>");
         }
     }
 }
Example #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        err_code.InnerHtml = "";
        error.InnerHtml    = "";
        if (!Page.IsPostBack)
        {
            btn_OK.Attributes.Add("onclick", "return CheckInput('0')");
            TokenValidate.IsRedircet = true;
            TokenValidate.Validate();
            if (CommonBizRules.IsUrlParams(HttpContext.Current.Request.Url.OriginalString))
            {
                SPID      = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
                ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
            }
            CustID = TokenValidate.CustID;

            //语言密码为空
            if (PassWordBO.VoicePwdIsNull(CustID, out ErrMsg))
            {
                Label1.Text     = "输入登录密码";
                error.InnerHtml = "提示:您未设置过语音密码 请输入登录密码";
            }
        }
    }
Example #22
0
    protected void btnlogin_ServerClick(object sender, EventArgs e)
    {
        string ErrMeg = "";
        string er     = "";

        TokenValidate.IsRedircet = true;
        TokenValidate.Validate();
        CustID = TokenValidate.CustID;

        if (ddlQuestion1.SelectedIndex != 0 && txtAnswer1.Text.Trim().Length > 0)
        {
            PassWordBO.UpdatePwdQuestionAnswer(txtHidSq1.Text, CustID, ddlQuestion1.SelectedIndex, txtAnswer1.Text, out er);
            ErrMeg = ErrMeg + er;
        }

        if (ddlQuestion2.SelectedIndex != 0 && txtAnswer2.Text.Trim().Length > 0)
        {
            PassWordBO.UpdatePwdQuestionAnswer(txtHidSq2.Text, CustID, ddlQuestion2.SelectedIndex, txtAnswer2.Text, out er);
            ErrMeg = ErrMeg + er;
        }

        if (ddlQuestion3.SelectedIndex != 0 && txtAnswer3.Text.Trim().Length > 0)
        {
            PassWordBO.UpdatePwdQuestionAnswer(txtHidSq3.Text, CustID, ddlQuestion3.SelectedIndex, txtAnswer3.Text, out er);
            ErrMeg = ErrMeg + er;
        }

        CommonBizRules.SuccessRedirect("", "问题设置成功", this.Context);
        //if (ErrMeg == "")
        //{
        //    Context.Server.Transfer("verifyPasswordQnA.aspx");
        //}
        //else {
        //    Context.Server.Transfer("verifyPasswordQnA.aspx");
        //}
    }
Example #23
0
    public BasePage()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
        String     RealName, NickName, OuterID, CustType, LoginAuthenName, LoginAuthenType;
        HttpCookie cookie = HttpContext.Current.Request.Cookies[CookieName];

        if (cookie == null)
        {
            CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "您尚未登录,请登录", this.Context);
            return;
        }
        string strCIPToken = HttpContext.Current.Request.Cookies.Get(CookieName).Value;

        if (CommonUtility.IsEmpty(strCIPToken))
        {
            CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "您尚未登录,请登录", this.Context);
            return;
        }

        SPInfoManager spInfo = new SPInfoManager();
        Object        SPData = spInfo.GetSPData(HttpContext.Current, "SPData");
        string        key    = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
        UserToken     UT     = new UserToken();

        result = UT.ParseUserToken(strCIPToken, key, out custID, out RealName, out userName, out NickName, out OuterID, out CustType, out LoginAuthenName, out LoginAuthenType, out ErrMsg);
        //如果验证成功则重新生成Cookie以更新超时时间
        if (result == 0)
        {
            string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, LoginAuthenName, LoginAuthenType, key, out ErrMsg);

            PageUtility.SetCookie(CookieName, UserTokenValue);
        }
        //this.custID = "117663768";//117663768,26251932
    }
Example #24
0
    public int PhoneAuth()
    {
        string SPID = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());

        if (String.IsNullOrEmpty(SPID))
        {
            return(-1);
        }
        String ErrorDescription = "";
        int    Result           = CommonBizRules.SPInterfaceGrant(SPID, "SendSMSCode", this.Context, out ErrorDescription);

        if (Result != 0)
        {
            return(-2);
        }

        string ErrMsg   = "";
        string PhoneNum = HttpUtility.HtmlDecode(Request.QueryString["PhoneNum"].ToString());

        //int Result = PhoneBO.PhoneSel("", "", PhoneNum, SPID, out ErrMsg);
        //int Result = 0;
        Result = PhoneBO.PhoneSel("", PhoneNum, out ErrMsg);
        return(Result);
    }
Example #25
0
    public void SendCode()
    {
        Random random     = new Random();
        string AuthenCode = random.Next(111111, 999999).ToString();
        string PhoneNum   = HttpUtility.HtmlDecode(Request.QueryString["PhoneNum"].ToString());
        string SPID       = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
        string msg        = "";

        if (String.IsNullOrEmpty(SPID))
        {
            return;
        }
        string ErrorDescription = "";
        int    Result           = CommonBizRules.SPInterfaceGrant(SPID, "SendSMSCode", this.Context, out ErrorDescription);

        if (Result != 0)
        {
            return;
        }

        Result = PhoneBO.InsertPhoneSendMassage("", "", AuthenCode, PhoneNum, DateTime.Now, "", 1, 0, "1", out msg);
        //CommonBizRules.SendMessage(PhoneNum, "您的验证码是" + AuthenCode, SPID);
        CommonBizRules.SendMessageV3(PhoneNum, "您的验证码是" + AuthenCode, SPID);
    }
Example #26
0
    protected void RestPasswordByPhoneBtn_Click(object sender, ImageClickEventArgs e)
    {
        SPID = Request["SPID"] == null ? String.Empty : Request["SPID"].ToString();

        if ("35433334".Equals(SPID))
        {
            ReturnUrl = "http://www.114yg.cn/userCenterAction.do?actions=intoUserLogin";
        }
        else
        {
            ReturnUrl = "http://sso.118114.cn/SSO/loginV2.action";
        }
        this.hdReturnUrl.Value = ReturnUrl;
        AuthenPhone            = Request["AuthenPhone"];
        SmsAuthenCode          = Request["AuthenCode"];
        if (!String.IsNullOrEmpty(AuthenPhone))
        {
            this.hdAuthenPhone.Value = AuthenPhone;
        }
        if (!String.IsNullOrEmpty(SmsAuthenCode))
        {
            this.hdAuthenCode.Value = SmsAuthenCode;
        }


        AuthenPhone   = this.hdAuthenPhone.Value;
        SmsAuthenCode = this.hdAuthenCode.Value;
        ReturnUrl     = this.hdReturnUrl.Value;
        String        CustID = "";
        StringBuilder sbLog  = new StringBuilder();

        sbLog.AppendFormat("AuthenPhone:{0}\r\n", AuthenPhone);
        sbLog.AppendFormat("SmsAuthenCode:{0}\r\n", SmsAuthenCode);
        try
        {
            CustID = PhoneBO.IsAuthenPhone(AuthenPhone, SPID, out ErrMsg);
            sbLog.AppendFormat("CustID:{0}\r\n", CustID);
            sbLog.AppendFormat("ErrMsg:{0}\r\n", ErrMsg);
            if (!String.IsNullOrEmpty(CustID))
            {
                Result = PhoneBO.SelSendSMSMassage(CustID, AuthenPhone, SmsAuthenCode, out ErrMsg);
                sbLog.AppendFormat("SelSendSMSMassage:Result:{0}-{1}\r\n", Result, ErrMsg);
                if (Result == 0)
                {
                    Response.Redirect("ResetPwdByPhone.aspx?UrlParam=" + CustID + "$2$" + ReturnUrl, false);
                }
                else
                {
                    CommonBizRules.SuccessRedirect("../ErrorInfo.aspx", "找回密码失败:" + ErrMsg, HttpContext.Current);
                }
            }
            else
            {
                CommonBizRules.SuccessRedirect("../ErrorInfo.aspx", "该手机号码不是认证手机,找回密码失败:" + ErrMsg, HttpContext.Current);
            }
        }
        catch (Exception ex)
        {
            sbLog.AppendFormat("异常:{0}\r\n", ex.Message);
        }
        finally
        {
            log(sbLog.ToString());
        }
    }
Example #27
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void ProcessUnifyPlatformReturn()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            LSID      = Request["LSID"];
            appId     = Request["appId"];
            paras     = Request["paras"];
            sign      = Request["sign"];

            string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
            string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];


            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},LSID:{2},ReturnUrl:{3},appId:{4},paras:{5},sign:{6}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, LSID, ReturnUrl, appId, paras, sign);

            string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
            string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if (!newsign.Equals(sign))
            {
                Redirect("ErrMsg", "签名不正确");
            }

            //paras {result,accessToken,timeStamp,userId,productUid,loginNum,nickName,userIconUrl,userIconUrl2,userIconUrl3,isThirdAccount}
            string result         = "";
            string accessToken    = "";
            string timeStamp      = "";
            long   userId         = 0;
            string productUid     = "";
            string loginNum       = "";
            string nickName       = "";
            string userIconUrl    = "";
            string userIconUrl2   = "";
            string userIconUrl3   = "";
            string isThirdAccount = "";


            Dictionary <String, String> parames = new Dictionary <string, string>();
            strMsg.Append("开始解析unifyPlatformResponse\r\n");
            try
            {
                parames = splitParameters(unifyPlatformResponse);
                strMsg.AppendFormat("params:{0}\r\n", parames);
            }
            catch (Exception exp)
            {
                strMsg.AppendFormat(exp.ToString());
            }
            strMsg.Append("解析unifyPlatformResponse完毕\r\n");
            foreach (KeyValuePair <String, String> p in parames)
            {
                if (p.Key.Equals("result"))
                {
                    result = p.Value;
                    strMsg.AppendFormat("result:{0}\r\n", result);
                }
                if (p.Key.Equals("accessToken"))
                {
                    accessToken = p.Value;
                    strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
                }
                if (p.Key.Equals("timeStamp"))
                {
                    timeStamp = p.Value;
                    strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
                }
                if (p.Key.Equals("userId"))
                {
                    if (!String.IsNullOrEmpty(p.Value))
                    {
                        try
                        {
                            userId = userId = System.Int64.Parse(p.Value);
                        }
                        catch (Exception e)
                        {
                            userId = 0;
                        }
                    }
                    else
                    {
                        userId = 0;
                    }


                    strMsg.AppendFormat("userId:{0}\r\n", userId);
                }
                if (p.Key.Equals("productUid"))
                {
                    productUid = p.Value;
                    strMsg.AppendFormat("productUid:{0}\r\n", productUid);
                }
                if (p.Key.Equals("loginNum"))
                {
                    loginNum = p.Value;
                    strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
                }
                if (p.Key.Equals("nickName"))
                {
                    nickName = p.Value;
                    strMsg.AppendFormat("nickName:{0}\r\n", nickName);
                }
                if (p.Key.Equals("userIconUrl"))
                {
                    userIconUrl = p.Value;
                    strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
                }
                if (p.Key.Equals("userIconUrl2"))
                {
                    userIconUrl2 = p.Value;
                    strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
                }
                if (p.Key.Equals("userIconUrl3"))
                {
                    userIconUrl3 = p.Value;
                    strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
                }
                if (p.Key.Equals("isThirdAccount"))
                {
                    isThirdAccount = p.Value;
                    strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
                }
            }
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            #endregion

            #region 开始注册到号百
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken) && !String.IsNullOrEmpty(loginNum))
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                CustID = String.Empty;
                Regex  regMobile  = new Regex(@"^1[345678]\d{9}$");
                Regex  regEmail   = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                RealName = loginNum;
                if (regMobile.IsMatch(loginNum))
                {
                    MobileName = loginNum;
                }

                if (regEmail.IsMatch(loginNum))
                {
                    EmailName = loginNum;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt("123456");
                String OperType        = "2"; //1注册、2登录、3单点登录、4帐号提升

                if (!String.IsNullOrEmpty(loginNum))
                {
                    strMsg.Append("【开始注册或绑定到号百】:\r\n");
                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, userId, SPID, OperType, out CustID, out ErrMsg);
                    strMsg.Append("【开始注册或绑定到号百的结果】:\r\n");
                    strMsg.AppendFormat("Result:{0},CustID:{1}<->UsesrID:{2},ErrMsg:{3}\r\n", Result, CustID, userId, ErrMsg);

                    //注册成功,种下cookie
                    if (Result == 0)
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:客户不存在" + CustID);
                            //客户不存在
                            Redirect("ErrMsg", "客户不存在");
                        }

                        //登录tab写入cookie
                        PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        //生成Ticket
                        ticket = CommonBizRules.CreateTicket();
                        if (userId != null && userId != 0)
                        {
                            OuterID = "123456";
                        }
                        Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(userId), "42", out ErrMsg);
                        //insertAccessToken

                        if ((userId != 0) && !String.IsNullOrEmpty(CustID) && !String.IsNullOrEmpty(loginNum))
                        {
                            strMsg.Append("记录AccessToken\r\n");
                            strMsg.AppendFormat("CustID:{0}<->AccessToken:{1}\r\n", CustID, accessToken);
                            String Description = "web登录";
                            Result = CIP2BizRules.InsertAccessToken(SPID, HttpContext.Current.Request.UserHostAddress.ToString(), accessToken, Convert.ToString(userId), CustID, RealName, NickName, loginNum, OperType, Description, out ErrMsg);
                            strMsg.AppendFormat("InsertAccessToken:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
                        }
                        else
                        {
                            strMsg.Append("因为CustID为空,导致AccessToken无法记录,可能是绑定失败的原因\r\n");
                        }
                        strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                            Redirect("ErrMsg", "Ticket生成失败");
                        }
                        strMsg.Append(",Message:生成ticket成功,返回业务系统\r\n");
                        ReturnUrl = Request["ReturnUrl"];
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
                    }
                    else
                    {
                        strMsg.Append("绑定失败\r\n");
                    }
                }
                else
                {
                    Result = -7766;
                    ErrMsg = "loginNum为空,所以绑定或注册号百客户";
                    strMsg.Append("loginNum为空,所以绑定或注册号百客户\r\n");
                }
                strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            }

            //下面删掉一大段

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Example #28
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        UserName = Request.Form["UserName"].ToString().Trim();

        Password = Request.Form["Password"].ToString().Trim();

        Password2 = Request.Form["Password2"].ToString().Trim();

        try
        {
            Result = CustBasicInfo.IsExistUser(UserName);
            if (Result != 0)
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('用户名已存在!')</script>";
                return;
            }

            Result = UserRegistry.UserRegisterWebLowStint(SPID, UserName, Password, out CustID, out ErrMsg);

            if (Result == 0)
            {
                // 重定向到欢迎页面

                String IPAddress = Request.UserHostAddress.ToString();
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "client_wap");


                String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=" + Device + "&custId=" + CustID;
                String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                //{"returnCode":"00000"}
                string youhuiquan = "";
                resuzt.TryGetValue("returnCode", out youhuiquan);


                String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                SPInfoManager spInfo                = new SPInfoManager();
                Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
                String        key                   = spInfo.GetPropertyBySPID("35000000", "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    RealName       = UserName;
                String    NickName       = UserName;
                string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
                string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
                CreateSPTokenRequest();
                StringBuilder URL = new StringBuilder();
                URL.Append("LowSintRegisterMSuccess.aspx?SPID=");
                Response.Redirect(URL.ToString() + SPID + "&SPTokenRequest=" + newSPTokenRequest, true);
            }
            else
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('注册失败:" + ErrMsg + "')</script>";
                return;
            }
        }
        catch (Exception exp)
        {
            errorHint.InnerHtml = "<script type='text/javascript'>showError('" + exp.ToString() + "!')</script>";
            return;
        }
    }
Example #29
0
    protected void login_Click(object sender, EventArgs e)
    {
        Response.AddHeader("P3P", "CP=CAO PSA OUR");
        StringBuilder strLog = new StringBuilder();
        //string AuthenType = HttpUtility.HtmlDecode(Request.Form["AuthenType"].ToString().Trim().ToUpper());         //获取认证类型

        string AuthenName = username.Text;
        string Password   = password.Text;
        string AuthenType = "1";  // 默认是用户名

        Regex regMobile = new Regex(@"^1[3458]\d{9}$");
        Regex regEmail  = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
        Regex regCard   = new Regex(@"^(\d{9}|\d{16})$");

        if (regMobile.IsMatch(AuthenName))
        {
            AuthenType = "2";
        }
        if (regEmail.IsMatch(AuthenName))
        {
            AuthenType = "4";
        }
        if (regCard.IsMatch(AuthenName))
        {
            AuthenType = "3";
        }


        PageUtility.SetCookie("AuthenType", AuthenType, 168);           //168个小时,即一个礼拜


        string CustID      = "";
        string RealName    = "";
        string NickName    = "";
        string UserName    = "";
        string OutID       = "";
        string UserAccount = "";
        string ErrMsg      = "";
        string CustType    = "";
        string ProvinceID  = "";
        int    Result      = 1;

        try
        {
            strLog.AppendFormat("checkCode={0}", Request.Form["checkCode"]);
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(Request.Form["checkCode"].ToString().Trim()), this.Context))
            {
                errorHint.InnerHtml = "验证码错误,请重新输入";
                return;
            }

            //日志
            strLog.AppendFormat("【开始验证】:SPID:{0},ProvinceID:{1},AuthenName:{2},AuthenType:{3}", SPID, ProvinceID, AuthenName, AuthenType);

            Result = BTForBusinessSystemInterfaceRules.UserAuthV2(SPID, AuthenName, AuthenType, Password, Context, ProvinceID, "", "",
                                                                  out ErrMsg, out CustID, out UserAccount, out CustType, out OutID, out ProvinceID, out RealName, out UserName, out NickName);
            //验证结果日志
            strLog.AppendFormat("【验证结果】:CustID:{0},UserAcount:{1},CustType:{2},OutID:{3},ProvinceID:{4},RealName:{5},UserName:{6},NickName:{7}",
                                CustID, UserAccount, CustType, OutID, ProvinceID, RealName, UserName, NickName);
            CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, ProvinceID, AuthenType, AuthenName, "2", Result, ErrMsg);
            if (Result != 0)
            {
                if (Result == 1001 || Result == -20504 || Result == -21553)
                {
                    errorHint.InnerHtml = ErrMsg;
                    //hint_Username.InnerHtml = "";
                    return;
                }

                if (Result == -21501)
                {
                    errorHint.InnerHtml = ErrMsg;
                    return;
                }
                Response.Write(ErrMsg);
                return;
            }

            SPInfoManager spInfo = new SPInfoManager();
            Object        SPData = spInfo.GetSPData(this.Context, "SPData");
            string        key    = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);

            //生成token并保存
            UserToken UT             = new UserToken();
            string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OutID, CustType, AuthenName, AuthenType, key, out ErrMsg);
            string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            PageUtility.SetCookie(CookieName, UserTokenValue);

            TokenValidate.IsRedircet = false;
            TokenValidate.Validate();

            this.ssoFunc();
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Example #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string CookieName  = "";
        string token       = "";
        string CustID      = "";
        string RealName    = "";
        string UserName    = "";
        string NickName    = "";
        string OuterID     = "";
        string CustType    = "";
        string AuthenName  = "";
        string AuthenType  = "";
        string RedirectUrl = "";
        string key         = "";
        string ErrMsg      = "";
        int    Result      = ErrorDefinition.IError_Result_UnknowError_Code;

        if (!this.IsPostBack)
        {
            CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            token      = PageUtility.GetCookie(CookieName);
            if (String.IsNullOrEmpty(token))
            {
                Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=请先登录积分商城", true);
                return;
            }

            UserToken UT = new UserToken();
            key    = System.Configuration.ConfigurationManager.AppSettings["ScoreSystemSecret"];
            Result = UT.ParseScoreUserToken(token, key, out ProvinceID, out CustID, out RealName, out UserName, out NickName, out OuterID, out CustType, out AuthenName, out AuthenType, out ErrMsg);
            if (Result == 0)
            {
                string par_ProvinceID = Request["ProvinceID"];
                if (par_ProvinceID.Equals(ProvinceID))
                {
                    String Ticket = CommonBizRules.CreateTicket();
                    Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, NickName, UserName, OuterID, "", AuthenName, AuthenType, out ErrMsg);

                    if (Result != 0)
                    {
                        Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=票据生成失败,请重新登录积分商城", true);
                        return;   // 重定向至哪里
                    }

                    // 根据ProvinceID 查出 Redirecturl

                    Result = CIP2BizRules.GetRedirectUrlByProvince(ProvinceID, out RedirectUrl, out ErrMsg);
                    if (Result == 0)
                    {
                        if (!String.IsNullOrEmpty(RedirectUrl))
                        {
                            if (RedirectUrl.IndexOf("?") > 0)
                            {
                                RedirectUrl = RedirectUrl + "&Ticket=" + Ticket;
                            }
                            else
                            {
                                RedirectUrl = RedirectUrl + "?Ticket=" + Ticket;
                            }
                        }
                        else
                        {
                            // 根据provinvce 获取redirecturl 为空 ,该转向哪里
                            Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=未配置该省的返回地址", true);
                        }
                    }
                    else
                    {
                        // 根据province获得url失败,该返回哪里?
                        Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=根据省ID获取返回地址失败", true);
                    }
                    Response.Redirect(RedirectUrl, true);
                }
                else
                {
                    Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=省ID不匹配当前token中的省ID", true);
                }
            }
            else   // token  存在但是解析失败
            {
                RedirectUrl = Request.Url.AbsoluteUri;
                Response.Redirect(RedirectUrl, true);
            }
        }
    }