Beispiel #1
0
        protected void ChangePwd_Click(object sender, EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings settings2 = SettingsManager.GetMasterSettings(false);
                string       str2      = string.Empty;
                if (!string.IsNullOrEmpty(settings2.DistributorLogoPic))
                {
                    str2 = Globals.DomainName + settings2.DistributorLogoPic;
                }
                string str3 = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", this.txt_phone.Text);
                parameters.Add("password", str3);
                parameters.Add("unitname", settings2.SiteName);
                parameters.Add("activated", "1");
                parameters.Add("logo", str2);
                parameters.Add("url", "");
                parameters.Add("tel", settings2.ShopTel);
                parameters.Add("contact", "");
                parameters.Add("location", "");
                string str4 = EnterpriseApi.UpdateEnterprise(tokenValue, parameters);
                if (!string.IsNullOrWhiteSpace(str4))
                {
                    string jsonValue = Common.GetJsonValue(str4, "errcode");
                    string str6      = Common.GetJsonValue(str4, "errmsg");
                    if (jsonValue == "0")
                    {
                        masterSettings.password = this.txt_pwd.Text;
                        CustomerServiceManager.Save(masterSettings);
                        this.ShowMsg("修改密码成功!", true);
                    }
                    else
                    {
                        this.ShowMsg("修改密码失败!(" + str6 + ")", false);
                    }
                }
                else
                {
                    this.ShowMsg("修改密码失败!", false);
                }
                this.enable = settings2.EnableSaleService;
            }
            else
            {
                this.ShowMsg("获取access_token失败!", false);
            }
        }
Beispiel #2
0
        protected void ChangePwd_Click(object sender, System.EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(false);
                string       value           = string.Empty;
                if (!string.IsNullOrEmpty(masterSettings2.DistributorLogoPic))
                {
                    value = Globals.DomainName + masterSettings2.DistributorLogoPic;
                }
                string value2 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                string text   = EnterpriseApi.UpdateEnterprise(tokenValue, new System.Collections.Generic.Dictionary <string, string>
                {
                    {
                        "unit",
                        this.txt_phone.Text
                    },
                    {
                        "password",
                        value2
                    },
                    {
                        "unitname",
                        masterSettings2.SiteName
                    },
                    {
                        "activated",
                        "1"
                    },
                    {
                        "logo",
                        value
                    },
                    {
                        "url",
                        ""
                    },
                    {
                        "tel",
                        masterSettings2.ShopTel
                    },
                    {
                        "contact",
                        ""
                    },
                    {
                        "location",
                        ""
                    }
                });
                if (!string.IsNullOrWhiteSpace(text))
                {
                    string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errcode");
                    string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errmsg");
                    if (jsonValue == "0")
                    {
                        masterSettings.password = this.txt_pwd.Text;
                        CustomerServiceManager.Save(masterSettings);
                        this.ShowMsg("修改密码成功!", true);
                    }
                    else
                    {
                        this.ShowMsg("修改密码失败!(" + jsonValue2 + ")", false);
                    }
                }
                else
                {
                    this.ShowMsg("修改密码失败!", false);
                }
                this.enable = masterSettings2.EnableSaleService;
                return;
            }
            this.ShowMsg("获取access_token失败!", false);
        }