Exemple #1
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (CommonBizRules.IsUrlParams(HttpContext.Current.Request.Url.OriginalString))
        {
            SPID      = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
            ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
        }

        if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(Request.Form["code"].ToString().Trim().ToUpper()), this.Context))
        {
            err_code.InnerHtml = "验证码错误,请重新输入";
            return;
        }
        OldPwd    = Request.Form["oldPasswd"].ToString().Trim();
        VerifyPwd = Request.Form["verifyPasswd"].ToString().Trim();
        if (!PassWordBO.OldPwdIsRight(CustID, OldPwd, "2", out ErrMsg))
        {
            //CommonBizRules.ErrorHappenedRedircet(-1, ErrMsg, "修改登录密码", this.Context);
            error.InnerHtml = "原始密码错误";
            return;
        }
        else
        {
            string ErrMsgSetPwd = "";
            int    Result       = PassWordBO.SetPassword(SPID, CustID, VerifyPwd, "2", "", out ErrMsgSetPwd);
            if (Result != 0)
            {
                CommonBizRules.ErrorHappenedRedircet(Result, ErrMsgSetPwd, "修改登录密码", this.Context);
            }
            CommonBizRules.SuccessRedirect(ReturnUrl, "修改登录成功", this.Context);
        }
    }
Exemple #2
0
    public String ModifyLoginPassword(String SPID, String CustID, String OldPwd, String NewPwd)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;

        #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(CustID))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                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>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(OldPwd))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "OldPwd不能为空!");
                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>", "OldPwd不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(NewPwd))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "NewPwd不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "NewPwd不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion

        #region
        //验证旧密码
        bool IsRight = PassWordBO.OldPwdIsRight(CustID, OldPwd, "2", out ErrMsg);
        if (IsRight)
        {
            Result = PassWordBO.SetPassword(SPID, CustID, NewPwd, "2", "", out ErrMsg);
            if (Result != 0)
            {
                Result = -22500;
                ErrMsg = "密码修改失败";

                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-22500");
                    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>", "-22500");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码修改失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                Result             = 0;
                ErrMsg             = "密码修改成功";
                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
        {
            Result             = -20504;
            ErrMsg             = "原始密码不匹配";
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-20504");
                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>", "-20504");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "原始密码不匹配!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        #endregion

        return(ResponseMsg.ToString());
    }
    public void bbb()
    {
        string CustID           = HttpUtility.HtmlDecode(Request.QueryString["custID"].ToString());
        string AuthenNumber     = HttpUtility.HtmlDecode(Request.QueryString["name"].ToString());
        string CustType         = HttpUtility.HtmlDecode(Request.QueryString["custType"].ToString());
        string Pwd              = HttpUtility.HtmlDecode(Request.QueryString["pwd"].ToString());
        string PwdType          = "2";
        string SPID             = "35000000";
        int    Result1          = 0;
        int    Result2          = 0;
        string ErrorDescription = "";
        string ExtendField      = "";
        string ErrMsg           = "";
        string IPAddress        = "";


        try
        {
            //数据合法性判断

            if (CommonUtility.IsEmpty(CustID))
            {
                Result1          = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + "不能为空";
            }

            if (CustID.Length > ConstDefinition.Length_CustID)
            {
                Result1          = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + "长度有误";
            }

            if (CommonUtility.IsEmpty(Pwd))
            {
                Result1          = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg;
            }



            //数据库操作

            Result1 = PassWordBO.SetPassword(SPID, CustID, Pwd, PwdType, ExtendField, out ErrorDescription);
        }
        catch (Exception e)
        {
            Result1          = ErrorDefinition.IError_Result_System_UnknowError_Code;
            ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + e.Message;
        }
        try
        {
            if (Context.Request.ServerVariables["HTTP_VIA"] != null)                            // using proxy
            {
                IPAddress = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); // Return real client IP.
            }
            else// not using proxy or can't get the Client IP
            {
                IPAddress = Context.Request.ServerVariables["REMOTE_ADDR"].ToString(); //While it can't get the Client IP, it will return proxy IP.
            }
            Result2 = FindPwd.InsertFindPwdLog(CustID, CustType, "0", "1", AuthenNumber, Result1, SPID, IPAddress, "", out ErrMsg);
        }
        catch (Exception e)
        {
            Result2          = ErrorDefinition.IError_Result_System_UnknowError_Code;
            ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + e.Message;
        }

        Response.Write(Result1);
    }
    public String FindBackPassWordByMobile(String SPID, String Phone, String AuthenCode, String PassWord)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #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(CustID))
        //{

        //    ResponseMsg.Length = 0;
        //    if ("json".Equals(wt))
        //    {
        //        ResponseMsg.Append("{");
        //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
        //        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>", "996");
        //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
        //        ResponseMsg.Append("</PARAMETERS>");
        //        ResponseMsg.Append("</PayPlatRequestParameter>");
        //    }
        //    return ResponseMsg.ToString();
        //}

        if (CommonUtility.IsEmpty(Phone))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                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>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(AuthenCode))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                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>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (String.IsNullOrEmpty(PassWord))
        {
            PassWord = "******";
        }

        #endregion
        try
        {
            String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            if (String.IsNullOrEmpty(t_custid))
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                    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>", "998");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证手机有误!手机未注册");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }

            //if (!CustID.Equals(t_custid))
            //{

            //    ResponseMsg.Length = 0;
            //    if ("json".Equals(wt))
            //    {
            //        ResponseMsg.Append("{");
            //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "993");
            //        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>", "993");
            //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "客户CustID和验证手机有误");
            //        ResponseMsg.Append("</PARAMETERS>");
            //        ResponseMsg.Append("</PayPlatRequestParameter>");
            //    }
            //    return ResponseMsg.ToString();
            //}

            //验证码校验
            Result = PhoneBO.SelSendSMSMassage(t_custid, Phone, AuthenCode, out ErrMsg);
            if (Result != 0)
            {
                //Result.ErrMsg = "验证码验证失败:" + Result.ErrMsg;
                //return Result;

                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "992");
                    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>", "992");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码验证失败");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }

            //修改密码
            Result             = PassWordBO.SetPassword(SPID, t_custid, PassWord, "2", "", out ErrMsg);
            ResponseMsg.Length = 0;
            if (Result == 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}\",", "-2508");
                    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>", "-2508");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</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}\",", "-2508");
                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>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置失败" + exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        return(ResponseMsg.ToString());
    }