protected void Page_Load(object sender, EventArgs e)
        {
            this.openIdType = this.GetParameter("HIGW");
            if (!string.IsNullOrEmpty(this.openIdType))
            {
                this.openIdType = this.openIdType.ToLower().Replace("_", ".");
            }
            OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(this.openIdType);

            if (openIdSettings == null)
            {
                base.Response.Write("登录失败,没有找到对应的插件配置信息。");
            }
            else
            {
                this.parameters = new NameValueCollection
                {
                    this.Page.Request.Form,
                    this.Page.Request.QueryString
                };
                OpenIdNotify openIdNotify = OpenIdNotify.CreateInstance(this.openIdType, this.parameters);
                openIdNotify.Authenticated += this.Notify_Authenticated;
                openIdNotify.Failed        += this.Notify_Failed;
                try
                {
                    openIdNotify.Verify(30000, HiCryptographer.Decrypt(openIdSettings.Settings));
                }
                catch
                {
                    this.Page.Response.Redirect("/");
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string            openIdType     = "hishop.plugins.openid.alipay.alipayservice";
            OpenIdSettingInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType);

            if (openIdSettings != null)
            {
                string      value       = base.Request.QueryString["alipaytoken"];
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings));
                SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();
                sortedDictionary.Add("service", "user.logistics.address.query");
                sortedDictionary.Add("partner", xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText);
                sortedDictionary.Add("_input_charset", "utf-8");
                sortedDictionary.Add("return_url", Globals.FullPath("openid/LogisticsAddress_url"));
                sortedDictionary.Add("token", value);
                Dictionary <string, string> dictionary = OpenIdFunction.FilterPara(sortedDictionary);
                string value2 = OpenIdFunction.BuildMysign(dictionary, xmlDocument.FirstChild.SelectSingleNode("Key").InnerText, "MD5", "utf-8");
                dictionary.Add("sign", value2);
                dictionary.Add("sign_type", "MD5");
                StringBuilder stringBuilder = new StringBuilder();
                foreach (KeyValuePair <string, string> item in dictionary)
                {
                    stringBuilder.Append(OpenIdFunction.CreateField(item.Key, item.Value));
                }
                sortedDictionary.Clear();
                dictionary.Clear();
                OpenIdFunction.Submit(OpenIdFunction.CreateForm(stringBuilder.ToString(), "https://mapi.alipay.com/gateway.do?_input_charset=utf-8"));
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.openIdType = base.Request.QueryString["t"];
            if (string.IsNullOrEmpty(this.openIdType) || this.openIdType.Trim().Length == 0)
            {
                base.GotoResourceNotFound();
            }
            PluginItem pluginItem = OpenIdPlugins.Instance().GetPluginItem(this.openIdType);

            if (pluginItem == null)
            {
                base.GotoResourceNotFound();
            }
            if (!this.Page.IsPostBack)
            {
                this.txtName.Text          = pluginItem.DisplayName;
                this.lblDisplayName.Text   = pluginItem.DisplayName;
                this.lblDisplayName2.Text  = pluginItem.DisplayName;
                this.txtSelectedName.Value = this.openIdType;
                OpenIdSettingInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(this.openIdType);
                if (openIdSettings != null)
                {
                    ConfigData configData = new ConfigData(HiCryptographer.Decrypt(openIdSettings.Settings));
                    this.txtConfigData.Value = configData.SettingsXml;
                    this.txtName.Text        = openIdSettings.Name;
                    this.fcContent.Text      = openIdSettings.Description;
                }
                this.lblDisplayName2.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string     text       = base.Request.QueryString["ot"];
            PluginItem pluginItem = OpenIdPlugins.Instance().GetPluginItem(text);
            string     text2      = "WapShop";

            if (string.IsNullOrEmpty(this.Page.Request.RawUrl))
            {
                goto IL_0049;
            }
            goto IL_0049;
IL_0049:
            if (pluginItem == null)
            {
                this.lblMsg.Text = "没有找到对应的插件,<a href=\"/\">返回首页</a>。";
            }
            else
            {
                OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text);
                if (openIdSettings == null)
                {
                    this.lblMsg.Text = "请先配置此插件所需的信息,<a href=\"/\">返回首页</a>。";
                }
                else
                {
                    string returnUrl = Globals.FullPath(base.GetRouteUrl("OpenIdEntry_url", new
                    {
                        HIGW = text.Replace(".", "_")
                    }));
                    OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl);
                    openIdService.Post();
                }
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string     text       = base.Request.QueryString["ot"];
            PluginItem pluginItem = OpenIdPlugins.Instance().GetPluginItem(text);

            if (pluginItem == null)
            {
                this.msg = "没有找到对应的插件,<a href=\"/\">返回首页</a>。";
            }
            else
            {
                OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text);
                if (openIdSettings == null)
                {
                    this.msg = "请先配置此插件所需的信息,<a href=\"/\">返回首页</a>。";
                }
                else
                {
                    string text2 = base.Request.QueryString["returnUrl"];
                    string text3 = base.Request.QueryString["client"].ToNullString();
                    if (string.IsNullOrEmpty(text3))
                    {
                        text3 = "wapshop";
                    }
                    string returnUrl = Globals.FullPath(base.GetRouteUrl("OpenIdEntry_url_Wap", new
                    {
                        HIGW = text.Replace(".", "_")
                    })).ToLower().Replace("/wapshop/", "/" + text3 + "/");
                    OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl);
                    openIdService.Post();
                }
            }
        }
        public void SaveSettings(OpenIdSettingInfo settings)
        {
            OpenIdSettingInfo openIdSetting = this.GetOpenIdSetting(settings.OpenIdType);

            if (openIdSetting != null)
            {
                this.Update(settings, null);
            }
            else
            {
                this.Add(settings, null);
            }
        }
        public static OpenIdSettingInfo PopulateOpenIdSettingInfo(IDataRecord reader)
        {
            if (reader == null)
            {
                return(null);
            }
            OpenIdSettingInfo openIdSettingInfo = new OpenIdSettingInfo();

            openIdSettingInfo.OpenIdType  = (string)reader["OpenIdType"];
            openIdSettingInfo.Name        = (string)reader["Name"];
            openIdSettingInfo.Description = (string)reader["Description"];
            openIdSettingInfo.Settings    = (string)reader["Settings"];
            return(openIdSettingInfo);
        }
        public OpenIdSettingInfo GetOpenIdSetting(string openIdType)
        {
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT [OpenIdType],[Name],[Description],[Settings] FROM [dbo].[aspnet_OpenIdSettings] WHERE OpenIdType=@OpenIdType");

            base.database.AddInParameter(sqlStringCommand, "OpenIdType", DbType.String, openIdType);
            OpenIdSettingInfo result = null;

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = OpenIdSettingDao.PopulateOpenIdSettingInfo(dataReader);
                }
            }
            return(result);
        }
Beispiel #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ConfigData configData = default(ConfigData);

            if (this.ValidateValues(out configData))
            {
                OpenIdSettingInfo settings = new OpenIdSettingInfo
                {
                    Name        = this.txtName.Text.Trim(),
                    Description = this.fcContent.Text,
                    OpenIdType  = this.openIdType,
                    Settings    = HiCryptographer.Encrypt(configData.SettingsXml)
                };
                OpenIdHelper.SaveSettings(settings);
                base.Response.Redirect("openidservices.aspx");
            }
        }
Beispiel #10
0
 private void OpenIdEntryInit()
 {
     this.settings = MemberProcessor.GetOpenIdSettings(this.openIdType);
     if (this.settings == null)
     {
         this.ShowMessage("登录失败,没有找到对应的插件配置信息。", false, "/User/Login", 2);
     }
     else
     {
         this.Parameters = new NameValueCollection
         {
             this.Page.Request.Form,
             this.Page.Request.QueryString
         };
         this.notify = OpenIdNotify.CreateInstance(this.openIdType, this.Parameters);
         this.notify.Authenticated += this.Notify_Authenticated;
         this.notify.Failed        += this.Notify_Failed;
         this.notify.Verify(30000, HiCryptographer.Decrypt(this.settings.Settings));
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int num = 0;
            SortedDictionary <string, string> requestPost = this.GetRequestPost();

            if (requestPost.Count > 0)
            {
                string            openIdType     = "hishop.plugins.openid.alipay.alipayservice";
                OpenIdSettingInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType);
                if (openIdSettings == null)
                {
                    base.Response.Write("登录失败,没有找到对应的插件配置信息。");
                    return;
                }
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings));
                AliPayNotify aliPayNotify = new AliPayNotify(requestPost, base.Request.Form["notify_id"], xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText, xmlDocument.FirstChild.SelectSingleNode("Key").InnerText);
                string       responseTxt  = aliPayNotify.ResponseTxt;
                string       a            = base.Request.Form["sign"];
                string       mysign       = aliPayNotify.Mysign;
                if (responseTxt == "true" && a == mysign)
                {
                    string text = base.Request.Form["receive_address"];
                    if (!string.IsNullOrEmpty(text))
                    {
                        XmlDocument xmlDocument2 = new XmlDocument();
                        xmlDocument.XmlResolver = null;
                        xmlDocument2.LoadXml(text);
                        ShippingAddressInfo shippingAddressInfo = new ShippingAddressInfo();
                        shippingAddressInfo.UserId = HiContext.Current.UserId;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/address") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText))
                        {
                            shippingAddressInfo.Address = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/fullname") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText))
                        {
                            shippingAddressInfo.ShipTo = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/post") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText))
                        {
                            shippingAddressInfo.Zipcode = xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText))
                        {
                            shippingAddressInfo.CellPhone = xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText))
                        {
                            shippingAddressInfo.TelPhone = xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText;
                        }
                        string text2 = string.Empty;
                        string text3 = string.Empty;
                        string text4 = string.Empty;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/area") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText))
                        {
                            text2 = xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/city") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText))
                        {
                            text3 = xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/prov") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText))
                        {
                            text4 = xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText;
                        }
                        if (string.IsNullOrEmpty(text2) && string.IsNullOrEmpty(text3) && string.IsNullOrEmpty(text4))
                        {
                            shippingAddressInfo.RegionId = 0;
                        }
                        else
                        {
                            shippingAddressInfo.RegionId = RegionHelper.GetRegionId(text2, text3, text4);
                        }
                        SiteSettings siteSettings = HiContext.Current.SiteSettings;
                        if (MemberProcessor.GetShippingAddressCount(HiContext.Current.UserId) < HiContext.Current.Config.ShippingAddressQuantity)
                        {
                            shippingAddressInfo.FullRegionPath = RegionHelper.GetFullPath(shippingAddressInfo.RegionId, true);
                            num = MemberProcessor.AddShippingAddress(shippingAddressInfo);
                        }
                    }
                }
            }
            this.Page.Response.Redirect("/SubmmitOrder.aspx?shippingId=" + num);
        }
Beispiel #12
0
        protected override void AttachChildControls()
        {
            string a = this.Page.Request["action"].ToNullString().ToLower();

            if (a == "register")
            {
                PageTitle.AddSiteNameTitle("登录");
            }
            else
            {
                PageTitle.AddSiteNameTitle("注册");
            }
            this.hidIsAuth              = (HtmlInputHidden)this.FindControl("hid_IsAuth");
            this.hidAuthMsg             = (HtmlInputHidden)this.FindControl("hid_AuthMsg");
            this.hidOpenIdType          = (HtmlInputHidden)this.FindControl("hid_OpenIdType");
            this.hidOpenId              = (HtmlInputHidden)this.FindControl("hid_OpenId");
            this.hidToken               = (HtmlInputHidden)this.FindControl("hid_Token");
            this.hidRealName            = (HtmlInputHidden)this.FindControl("hid_RealName");
            this.hidUserId              = (HtmlInputHidden)this.FindControl("hid_UserId");
            this.hidEmail               = (HtmlInputHidden)this.FindControl("hid_Email");
            this.hidIsNeedValidateEmail = (HiddenField)this.FindControl("hidIsNeedValidateEmail");
            this.hidIsOpenGeetest       = (HiddenField)this.FindControl("hidIsOpenGeetest");
            this.client              = (HtmlInputHidden)this.FindControl("client");
            this.client.Value        = base.ClientType.ToString().ToLower();
            this.smsenable           = (HiddenField)this.FindControl("smsenable");
            this.emailenable         = (HiddenField)this.FindControl("emailenable");
            this.txtUserName         = (HtmlInputText)this.FindControl("txtUserName");
            this.txtRegisterUserName = (HtmlInputText)this.FindControl("txtRegisterUserName");
            this.forgetPassword      = (HtmlAnchor)this.FindControl("forgetPassword");
            this.divRealName         = (HtmlGenericControl)this.FindControl("divRealName");
            this.divBirthday         = (HtmlGenericControl)this.FindControl("divBirthday");
            this.divSex              = (HtmlGenericControl)this.FindControl("divSex");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            this.hidIsNeedValidateEmail.Value = (masterSettings.IsNeedValidEmail ? "1" : "0");
            this.hidIsOpenGeetest.Value       = (masterSettings.IsOpenGeetest ? "1" : "0");
            this.labNickName  = (Label)this.FindControl("labNickName");
            this.labNickName1 = (Label)this.FindControl("labNickName1");
            this.labNickName2 = (Label)this.FindControl("labNickName2");
            this.userPicture  = (HtmlImage)this.FindControl("userPicture");
            this.hid_QuickLoginIsForceBindingMobbile       = (HtmlInputHidden)this.FindControl("hid_QuickLoginIsForceBindingMobbile");
            this.hid_QuickLoginIsForceBindingMobbile.Value = (masterSettings.QuickLoginIsForceBindingMobbile ? "true" : "false");
            if (masterSettings.RegistExtendInfo.Contains("RealName"))
            {
                this.divRealName.Visible = true;
            }
            if (masterSettings.RegistExtendInfo.Contains("Sex"))
            {
                this.divSex.Visible = true;
            }
            if (masterSettings.RegistExtendInfo.Contains("Birthday"))
            {
                this.divBirthday.Visible = true;
            }
            if (masterSettings.IsSurportEmail && masterSettings.IsSurportPhone && masterSettings.SMSEnabled && !string.IsNullOrEmpty(masterSettings.SMSSettings))
            {
                this.smsenable.Value   = "true";
                this.emailenable.Value = "true";
                this.txtUserName.Attributes.Add("placeholder", "请输入用户名/邮箱/手机");
                this.txtRegisterUserName.Attributes.Add("placeholder", "邮箱/手机");
                this.forgetPassword.Visible = true;
            }
            else if (!masterSettings.IsSurportEmail && (!masterSettings.IsSurportPhone || !masterSettings.SMSEnabled || string.IsNullOrEmpty(masterSettings.SMSSettings)))
            {
                this.smsenable.Value   = "false";
                this.emailenable.Value = "true";
                this.txtUserName.Attributes.Add("placeholder", "请输入用户名/邮箱");
                this.txtRegisterUserName.Attributes.Add("placeholder", "邮箱");
            }
            else if (masterSettings.IsSurportEmail && (!masterSettings.IsSurportPhone || !masterSettings.SMSEnabled || string.IsNullOrEmpty(masterSettings.SMSSettings)))
            {
                this.smsenable.Value   = "false";
                this.emailenable.Value = "true";
                this.txtUserName.Attributes.Add("placeholder", "请输入用户名/邮箱");
                this.txtRegisterUserName.Attributes.Add("placeholder", "邮箱");
            }
            else if (!masterSettings.IsSurportEmail && masterSettings.IsSurportPhone && masterSettings.SMSEnabled && !string.IsNullOrEmpty(masterSettings.SMSSettings))
            {
                this.smsenable.Value   = "true";
                this.emailenable.Value = "false";
                this.txtUserName.Attributes.Add("placeholder", "请输入用户名/手机");
                this.txtRegisterUserName.Attributes.Add("placeholder", "手机");
            }
            this.openIdType = base.GetParameter("HIGW");
            if (!string.IsNullOrEmpty(this.openIdType))
            {
                this.openIdType = this.openIdType.ToLower().Replace("_", ".");
                OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(this.openIdType);
                if (openIdSettings == null)
                {
                    this.AuthMsg = "没有找到对应的插件配置信息。";
                }
                else
                {
                    this.IsAuth     = true;
                    this.parameters = new NameValueCollection
                    {
                        this.Page.Request.Form,
                        this.Page.Request.QueryString
                    };
                    OpenIdNotify openIdNotify = OpenIdNotify.CreateInstance(this.openIdType, this.parameters);
                    openIdNotify.Authenticated += this.Notify_Authenticated;
                    openIdNotify.Failed        += this.Notify_Failed;
                    try
                    {
                        openIdNotify.Verify(30000, HiCryptographer.Decrypt(openIdSettings.Settings));
                    }
                    catch (Exception ex)
                    {
                        this.IsAuth  = false;
                        this.AuthMsg = ex.Message;
                    }
                    if (this.hidIsAuth != null)
                    {
                        this.hidIsAuth.Value = this.IsAuth.ToString();
                    }
                    if (this.hidAuthMsg != null)
                    {
                        this.hidAuthMsg.Value = this.AuthMsg;
                    }
                    if (this.hidOpenId != null)
                    {
                        this.hidOpenId.Value = this.openId;
                    }
                    if (this.hidOpenIdType != null)
                    {
                        this.hidOpenIdType.Value = this.openIdType;
                    }
                }
            }
        }
Beispiel #13
0
 public static void SaveSettings(OpenIdSettingInfo settings)
 {
     new OpenIdSettingDao().SaveSettings(settings);
 }