コード例 #1
0
ファイル: ProductReviews.cs プロジェクト: damoOnly/e-commerce
        private bool userRegion(string username, string password)
        {
            HiContext current = HiContext.Current;
            Member    member  = Users.GetUser(0, username, false, true) as Member;

            if (member == null || member.IsAnonymous)
            {
                this.ShowMessage("用户名或密码错误", false);
                return(false);
            }
            member.Password = password;
            LoginUserStatus loginUserStatus = MemberProcessor.ValidLogin(member);

            if (loginUserStatus == LoginUserStatus.Success)
            {
                System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(member.Username, false);
                IUserCookie           userCookie = member.GetUserCookie();
                userCookie.WriteCookie(authCookie, 30, false);
                current.User = member;
                return(true);
            }
            if (loginUserStatus == LoginUserStatus.AccountPending)
            {
                this.ShowMessage("用户账号还没有通过审核", false);
                return(false);
            }
            if (loginUserStatus == LoginUserStatus.InvalidCredentials)
            {
                this.ShowMessage("用户名或密码错误", false);
                return(false);
            }
            this.ShowMessage("未知错误", false);
            return(false);
        }
コード例 #2
0
        private static string BuildReviewsQuery(ProductReviewQuery reviewQuery)
        {
            HiContext     current = HiContext.Current;
            StringBuilder builder = new StringBuilder();

            builder.Append("SELECT ReviewId FROM distro_Products p inner join distro_ProductReviews r on (r.productId=p.ProductId  AND r.DistributorUserId=p.DistributorUserId)");
            builder.AppendFormat(" WHERE r.DistributorUserId ={0}", HiContext.Current.User.UserId);
            if (!string.IsNullOrEmpty(reviewQuery.ProductCode))
            {
                builder.AppendFormat(" AND ProductCode LIKE '%{0}%'", DataHelper.CleanSearchString(reviewQuery.ProductCode));
            }
            if (!string.IsNullOrEmpty(reviewQuery.Keywords))
            {
                builder.AppendFormat(" AND p.ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(reviewQuery.Keywords));
            }
            if (reviewQuery.CategoryId.HasValue)
            {
                builder.AppendFormat(" AND (p.CategoryId = {0}", reviewQuery.CategoryId.Value);
                builder.AppendFormat(" OR  p.CategoryId IN (SELECT CategoryId FROM distro_Categories WHERE Path LIKE (SELECT Path FROM distro_Categories WHERE CategoryId = {0} AND DistributorUserId={1}) + '%'  AND DistributorUserId={1}))", reviewQuery.CategoryId.Value, HiContext.Current.User.UserId);
            }
            if (!string.IsNullOrEmpty(reviewQuery.SortBy))
            {
                builder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(reviewQuery.SortBy), reviewQuery.SortOrder.ToString());
            }
            return(builder.ToString());
        }
コード例 #3
0
        private bool userRegion(string username, string password)
        {
            HiContext current = HiContext.Current;
            Member    member  = Users.GetUser(0, username, false, true) as Member;

            if ((member == null) || member.IsAnonymous)
            {
                this.ShowMessage("用户名或密码错误", false);
                return(false);
            }
            member.Password = password;
            switch (MemberProcessor.ValidLogin(member))
            {
            case LoginUserStatus.Success:
            {
                HttpCookie authCookie = FormsAuthentication.GetAuthCookie(member.Username, false);
                member.GetUserCookie().WriteCookie(authCookie, 30, false);
                current.User = member;
                return(true);
            }

            case LoginUserStatus.AccountPending:
                this.ShowMessage("用户账号还没有通过审核", false);
                return(false);

            case LoginUserStatus.InvalidCredentials:
                this.ShowMessage("用户名或密码错误", false);
                return(false);
            }
            this.ShowMessage("未知错误", false);
            return(false);
        }
コード例 #4
0
        protected override string AuthenticateToken(UsernameToken token)
        {
            LoginUserStatus invalidCredentials = LoginUserStatus.InvalidCredentials;

            try
            {
                SiteManager user = Users.GetUser(0, token.Identity.Name, false, false) as SiteManager;

                if ((user != null) && user.IsAdministrator)
                {
                    HiContext current = HiContext.Current;

                    user.Password = Cryptographer.Decrypt(token.Password);

                    invalidCredentials = Users.ValidateUser(user);
                }
                else
                {
                    invalidCredentials = LoginUserStatus.InvalidCredentials;
                }
            }
            catch
            {
                invalidCredentials = LoginUserStatus.InvalidCredentials;
            }

            if (invalidCredentials == LoginUserStatus.Success)
            {
                return(token.Password);
            }

            return(Cryptographer.CreateHash(token.Password));
        }
コード例 #5
0
        protected override void AttachChildControls()
        {
            this.rptProduct = (ThemedTemplatedRepeater)this.FindControl("rptProduct");
            if (!this.Page.IsPostBack)
            {
                this.BindList();
            }
            this.div_activelist = (System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("div_activelist");
            if (this.div_activelist != null)
            {
                string type = string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["IsActiveOpen"])?"1":System.Configuration.ConfigurationManager.AppSettings["IsActiveOpen"].ToString();
                this.div_activelist.Visible = (type == "1") ? true : false;
            }

            if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = System.Web.HttpContext.Current.Request.Url.ToString();
                if (text.IndexOf("?") > -1)
                {
                    text = text + "&ReferralUserId=" + HiContext.Current.User.UserId;
                }
                else
                {
                    text = text + "?ReferralUserId=" + HiContext.Current.User.UserId;
                }
                this.Page.Response.Redirect(text);
                return;
            }
            HiContext current = HiContext.Current;

            PageTitle.AddTitle(current.SiteSettings.SiteName + " - " + current.SiteSettings.SiteDescription, HiContext.Current.Context);
        }
コード例 #6
0
        protected override string AuthenticateToken(UsernameToken token)
        {
            LoginUserStatus loginUserStatus;

            try
            {
                SiteManager siteManager = Users.GetUser(0, token.Identity.Name, false, false) as SiteManager;
                if (siteManager != null && siteManager.IsAdministrator)
                {
                    HiContext arg_29_0 = HiContext.Current;
                    siteManager.Password = HiCryptographer.Decrypt(token.Password);
                    loginUserStatus      = Users.ValidateUser(siteManager);
                }
                else
                {
                    loginUserStatus = LoginUserStatus.InvalidCredentials;
                }
            }
            catch
            {
                loginUserStatus = LoginUserStatus.InvalidCredentials;
            }
            if (loginUserStatus == LoginUserStatus.Success)
            {
                return(token.Password);
            }
            return(HiCryptographer.CreateHash(token.Password));
        }
コード例 #7
0
        protected override void Render(HtmlTextWriter writer)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       domainName     = Globals.DomainName;
            string       userAgent      = HttpContext.Current.Request.UserAgent;
            bool         flag           = false;

            flag = (masterSettings.OpenWap == 1 && true);
            bool flag2 = masterSettings.OpenVstore == 1 && true;

            if (string.IsNullOrEmpty(userAgent))
            {
                userAgent = "";
            }
            HiContext current = HiContext.Current;
            bool      flag3   = false;

            if (masterSettings.OpenMultStore)
            {
                flag3 = true;
            }
            string imageServerUrl = Globals.GetImageServerUrl();

            writer.Write("<script language=\"javascript\" type=\"text/javascript\"> \r\n            var skinPath = \"{0}\";\r\n            var HasWapRight = {1};\r\n            var IsOpenStores = {2};\r\n            var IsOpenReferral = {3};\r\n            var HasVshopRight = {4};\r\n            var ImageServerUrl=\"{5}\";\r\n  var ImageUploadPath=\"{6}\";\r\n        </script>", current.GetSkinPath(), flag ? "true" : "false", flag3.ToString().ToLower(), current.SiteSettings.OpenReferral.ToString().ToLower(), flag2 ? "true" : "false", imageServerUrl, string.IsNullOrEmpty(imageServerUrl) ? "/admin/UploadHandler.ashx?action=newupload" : "/admin/UploadHandler.ashx?action=remoteupdateimages");
            writer.WriteLine();
            this.RenderMetaCharset(writer);
            this.RenderMetaLanguage(writer);
            this.RenderFavicon(writer);
            this.RenderMetaAuthor(writer);
            this.RenderMetaGenerator(writer);
            if (!HttpContext.Current.Request.Url.ToString().ToLower().Contains("/desig_templete"))
            {
                this.LoadVideo(writer);
            }
        }
コード例 #8
0
        protected override void Render(HtmlTextWriter writer)
        {
            HiContext current = HiContext.Current;

            writer.Write("<script language=\"javascript\" type=\"text/javascript\"> \r\n            var applicationPath = \"{0}\";\r\n            var skinPath = \"{1}\";\r\n            var subsiteuserId = \"{2}\";\r\n        </script>", Globals.ApplicationPath, current.GetSkinPath(), current.SiteSettings.UserId.HasValue ? current.SiteSettings.UserId.Value.ToString() : "0");
            writer.WriteLine();
            this.RenderMetaCharset(writer);
            this.RenderMetaLanguage(writer);
            this.RenderFavicon(writer);
            this.RenderMetaAuthor(writer);
            this.RenderMetaGenerator(writer);
        }
コード例 #9
0
ファイル: HeadContainer.cs プロジェクト: yuelinsoft/himedi
        protected override void Render(HtmlTextWriter writer)
        {
            HiContext current = HiContext.Current;

            writer.Write("<script language=\"javascript\" type=\"text/javascript\"> \r\n            var applicationPath = \"{0}\";\r\n            var skinPath = \"{1}\";\r\n            var subsiteuserId = \"{2}\";\r\n        </script>", Globals.ApplicationPath, current.GetSkinPath(), current.SiteSettings.UserId.HasValue ? current.SiteSettings.UserId.Value.ToString() : "0");
            //writer.Write("<script language=\"javascript\" src=\"http://code.54kefu.net/kefu/js/197/262597.js\" charset=\"utf-8\"></script>");
            // writer.Write("<!-- JiaThis Button BEGIN -->");
            //writer.WriteLine();
            //writer.Write("<script type=\"text/javascript\" src=\"http://v3.jiathis.com/code/jiathis_r.js?uid=1334751641000509&move=0&amp;btn=r4.gif\" charset=\"utf-8\"></script>");
            // writer.Write("<!-- JiaThis Button END -->");
            writer.WriteLine();
            RenderMetaCharset(writer);
            RenderMetaLanguage(writer);
            RenderFavicon(writer);
            RenderMetaAuthor(writer);
            RenderMetaGenerator(writer);
        }
コード例 #10
0
        protected override void Render(HtmlTextWriter writer)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            HiContext    current        = HiContext.Current;

            writer.Write("<script language=\"javascript\" type=\"text/javascript\"> \r\n            var applicationPath = \"{0}\";\r\n            var skinPath = \"{1}\";\r\n            var subsiteuserId = \"{2}\";\r\n            var HasWapRight = {3};\r\n        </script>", new object[]
            {
                Globals.ApplicationPath,
                current.GetSkinPath(),
                current.SiteSettings.UserId.HasValue ? current.SiteSettings.UserId.Value.ToString() : "0",
                (masterSettings.OpenWap == 1 || Globals.IsTestDomain) ? "true" : "false"
            });
            writer.WriteLine();
            this.RenderMetaCharset(writer);
            this.RenderMetaLanguage(writer);
            this.RenderFavicon(writer);
            this.RenderMetaAuthor(writer);
            this.RenderMetaGenerator(writer);
        }
コード例 #11
0
        protected override void AttachChildControls()
        {
            if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = System.Web.HttpContext.Current.Request.Url.ToString();
                if (text.IndexOf("?") > -1)
                {
                    text = text + "&ReferralUserId=" + HiContext.Current.User.UserId;
                }
                else
                {
                    text = text + "?ReferralUserId=" + HiContext.Current.User.UserId;
                }
                this.Page.Response.Redirect(text);
                return;
            }
            HiContext current = HiContext.Current;

            PageTitle.AddTitle(current.SiteSettings.SiteName + " - " + current.SiteSettings.SiteDescription, HiContext.Current.Context);
        }
コード例 #12
0
        protected override void Render(HtmlTextWriter writer)
        {
            HiContext current = HiContext.Current;

            writer.Write(
                "<script language=\"javascript\" type=\"text/javascript\"> \r\n            var applicationPath = \"{0}\";\r\n            var skinPath = \"{1}\";\r\n            var subsiteuserId = \"{2}\";\r\n        </script>",
                Globals.ApplicationPath, current.GetSkinPath(),
                current.SiteSettings.UserId.HasValue ? current.SiteSettings.UserId.Value.ToString() : "0");
            //writer.Write(
            //    " <link type=\"text/css\" rel=\"stylesheet\" href=\"{0}/style/common.css\" />",
            //    current.GetSkinPath()
            //    );
            // 模版公共样式
            //<link type=\"text/css\" rel=\"stylesheet\" href=\"{0}/style/index.css\" />
            writer.WriteLine();
            this.RenderMetaCharset(writer);
            this.RenderMetaLanguage(writer);
            this.RenderFavicon(writer);
            this.RenderMetaAuthor(writer);
            this.RenderMetaGenerator(writer);
        }
コード例 #13
0
ファイル: Global.cs プロジェクト: spiltservice/cloudshop
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            HttpContext current  = HttpContext.Current;
            HiContext   current2 = HiContext.Current;

            if (current != null && current.User != null)
            {
                int num = current2.ManagerId = Convert.ToInt32(current.User.Identity.Name);
                if (current2.ManagerId != 0)
                {
                    FormsIdentity             formsIdentity = (FormsIdentity)current.User.Identity;
                    FormsAuthenticationTicket ticket        = formsIdentity.Ticket;
                    string[] array = ticket.UserData.Split(',');
                    current.User = new GenericPrincipal(formsIdentity, array);
                    if (array != null && array.Length != 0)
                    {
                        current2.RolesCacheKey = string.Join(",", array);
                    }
                }
            }
            current2.UserId = this.GetUserId();
        }
コード例 #14
0
ファイル: DistributorLogin.cs プロジェクト: yuelinsoft/himedi
        protected override void AttachChildControls()
        {
            HiContext current = HiContext.Current;

            if (Context.Request.IsAuthenticated)
            {
                FormsAuthentication.SignOut();
                HttpCookie  authCookie = FormsAuthentication.GetAuthCookie(HiContext.Current.User.Username, true);
                IUserCookie userCookie = HiContext.Current.User.GetUserCookie();
                if (userCookie != null)
                {
                    userCookie.DeleteCookie(authCookie);
                }
                RoleHelper.SignOut(HiContext.Current.User.Username);
                Page.Response.Cookies["hishopLoginStatus"].Value = "";
            }
            txtUserName     = (TextBox)FindControl("txtUserName");
            txtPassword     = (TextBox)FindControl("txtPassword");
            btnLogin        = (Button)FindControl("btnLogin");
            txtCode         = (TextBox)FindControl("txtCode");
            btnLogin.Click += new EventHandler(btnLogin_Click);
        }
コード例 #15
0
        private static string BuildProductConsultationQuery(ProductConsultationAndReplyQuery consultationQuery)
        {
            HiContext     current = HiContext.Current;
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("SELECT c.ConsultationId FROM distro_Products p inner join distro_ProductConsultations c on p.productId=c.ProductId AND p.DistributorUserId=c.DistributorUserId WHERE c.DistributorUserId ={0}", HiContext.Current.User.UserId);
            if (consultationQuery.Type == ConsultationReplyType.NoReply)
            {
                builder.Append(" AND c.ReplyUserId IS NULL ");
            }
            else if (consultationQuery.Type == ConsultationReplyType.Replyed)
            {
                builder.Append(" AND c.ReplyUserId IS NOT NULL");
            }
            if (consultationQuery.ProductId > 0)
            {
                builder.AppendFormat(" AND p.ProductId = {0}", consultationQuery.ProductId);
                return(builder.ToString());
            }
            if (!string.IsNullOrEmpty(consultationQuery.ProductCode))
            {
                builder.AppendFormat(" AND LOWER(p.ProductCode) LIKE '%{0}%'", DataHelper.CleanSearchString(consultationQuery.ProductCode));
            }
            if (!string.IsNullOrEmpty(consultationQuery.Keywords))
            {
                builder.AppendFormat(" AND p.ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(consultationQuery.Keywords));
            }
            if (consultationQuery.CategoryId.HasValue)
            {
                builder.AppendFormat(" AND (p.CategoryId = {0}", consultationQuery.CategoryId.Value);
                builder.AppendFormat(" OR p.CategoryId IN (SELECT CategoryId FROM distro_Categories WHERE Path LIKE (SELECT Path FROM distro_Categories WHERE CategoryId = {0} AND distro_Categories.DistributorUserId={1}) + '%' AND  distro_Categories.DistributorUserId={1}))", consultationQuery.CategoryId.Value, HiContext.Current.User.UserId);
            }
            if (!string.IsNullOrEmpty(consultationQuery.SortBy))
            {
                builder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(consultationQuery.SortBy), consultationQuery.SortOrder.ToString());
            }
            return(builder.ToString());
        }
コード例 #16
0
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            this.parameters.Add("CurrentOpenId", e.OpenId);
            HiContext  current        = HiContext.Current;
            MemberInfo memberByOpenId = MemberProcessor.GetMemberByOpenId(this.openIdType, e.OpenId);

            if (memberByOpenId != null)
            {
                Users.SetCurrentUser(memberByOpenId.UserId, 30, true, false);
                HiContext.Current.User = memberByOpenId;
                ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart();
                if (cookieShoppingCart != null)
                {
                    ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart);
                    ShoppingCartProcessor.ClearCookieShoppingCart();
                }
                if (!string.IsNullOrEmpty(this.parameters["token"]))
                {
                    HttpCookie httpCookie = new HttpCookie("Token_" + memberByOpenId.UserId);
                    httpCookie.HttpOnly = true;
                    httpCookie.Expires  = DateTime.Now.AddMinutes(30.0);
                    httpCookie.Value    = this.parameters["token"];
                    HttpContext.Current.Response.Cookies.Add(httpCookie);
                }
            }
            else
            {
                switch (this.openIdType.ToLower())
                {
                case "hishop.plugins.openid.alipay.alipayservice":
                    this.SkipAlipayOpenId();
                    break;

                case "hishop.plugins.openid.qq.qqservice":
                    this.SkipQQOpenId();
                    break;

                case "hishop.plugins.openid.taobao.taobaoservice":
                    this.SkipTaoBaoOpenId();
                    break;

                case "hishop.plugins.openid.sina.sinaservice":
                    this.SkipSinaOpenId();
                    break;

                default:
                    this.Page.Response.Redirect("/");
                    break;
                }
            }
            string a = this.parameters["HITO"];

            if (a == "1")
            {
                this.Page.Response.Redirect("/SubmmitOrder");
            }
            else
            {
                this.Page.Response.Redirect("/");
            }
        }
コード例 #17
0
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            this.openId = e.OpenId;
            this.Parameters.Add("CurrentOpenId", e.OpenId);
            this.openIdHF.Value = Globals.StripAllTags(this.Parameters["CurrentOpenId"]);
            this.HIGW.Value     = this.openIdType;
            HiContext  current    = HiContext.Current;
            MemberInfo memberInfo = null;

            if (!string.IsNullOrEmpty(e.OpenId))
            {
                memberInfo = MemberProcessor.GetMemberByOpenId(this.openIdType, e.OpenId);
                if (memberInfo == null && this.openIdType.ToLower() == "hishop.plugins.openid.weixin.weixinservice")
                {
                    memberInfo            = MemberProcessor.GetMemberByUnionId(this.openId);
                    this.hidUnionId.Value = this.openId;
                }
            }
            string text = string.Empty;

            switch (this.openIdType.ToLower())
            {
            case "hishop.plugins.openid.alipay.alipayservice":
                text = (string.IsNullOrEmpty(this.Parameters["real_name"]) ? string.Empty : this.Parameters["real_name"].Trim());
                break;

            case "hishop.plugins.openid.qq.qqservice":
            {
                HttpCookie httpCookie3 = HttpContext.Current.Request.Cookies["NickName"];
                if (httpCookie3 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie3.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.taobao.taobaoservice":
            {
                HttpCookie httpCookie4 = HttpContext.Current.Request.Cookies["NickName"];
                if (httpCookie4 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie4.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.sina.sinaservice":
            {
                HttpCookie httpCookie2 = HttpContext.Current.Request.Cookies["SinaNickName"];
                if (httpCookie2 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie2.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.weixin.weixinservice":
            {
                HttpCookie httpCookie = HttpContext.Current.Request.Cookies["NickName"];
                if (httpCookie != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie.Value).Trim();
                }
                break;
            }

            default:
                this.Page.Response.Redirect("/", true);
                break;
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.btnLogin.Text     = text + "," + this.btnLogin.Text;
                this.labNickName.Text  = text;
                this.hidNickName.Value = text;
            }
            if (memberInfo != null)
            {
                this.SetLoginState(memberInfo, 0);
            }
        }
コード例 #18
0
ファイル: OpenIdEntry.cs プロジェクト: damoOnly/e-commerce
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            this.parameters.Add("CurrentOpenId", e.OpenId);
            HiContext current            = HiContext.Current;
            string    usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, this.openIdType);

            if (!string.IsNullOrEmpty(usernameWithOpenId))
            {
                Member member = Users.GetUser(0, usernameWithOpenId, false, true) as Member;
                if (member == null)
                {
                    base.Response.Write("登录失败,信任登录只能用于会员登录。");
                    return;
                }
                if (member.ParentUserId.HasValue && member.ParentUserId.Value != 0)
                {
                    base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。");
                    return;
                }
                System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(member.Username, false);
                IUserCookie           userCookie = member.GetUserCookie();
                userCookie.WriteCookie(authCookie, 30, false);
                HiContext.Current.User = member;
                ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart();
                current.User = member;
                if (cookieShoppingCart != null)
                {
                    ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart);
                    ShoppingCartProcessor.ClearCookieShoppingCart();
                }
                if (!string.IsNullOrEmpty(this.parameters["token"]))
                {
                    System.Web.HttpCookie httpCookie = new System.Web.HttpCookie("Token_" + HiContext.Current.User.UserId.ToString());
                    httpCookie.Expires = System.DateTime.Now.AddMinutes(30.0);
                    httpCookie.Value   = this.parameters["token"];
                    System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
                }
            }
            else
            {
                string a;
                if ((a = this.openIdType.ToLower()) != null)
                {
                    if (a == "Ecdev.plugins.openid.alipay.alipayservice")
                    {
                        this.SkipAlipayOpenId();
                        goto IL_1EF;
                    }
                    if (a == "Ecdev.plugins.openid.qq.qqservice")
                    {
                        this.SkipQQOpenId();
                        goto IL_1EF;
                    }
                    if (a == "Ecdev.plugins.openid.taobao.taobaoservice")
                    {
                        this.SkipTaoBaoOpenId();
                        goto IL_1EF;
                    }
                    if (a == "Ecdev.plugins.openid.sina.sinaservice")
                    {
                        this.SkipSinaOpenId();
                        goto IL_1EF;
                    }
                }
                this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
            }
IL_1EF:
            string a2 = this.parameters["HITO"];

            if (a2 == "1")
            {
                this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder"));
                return;
            }
            this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
        }
コード例 #19
0
        protected override void AttachChildControls()
        {
            HiContext current = HiContext.Current;

            PageTitle.AddTitle(current.SiteSettings.SiteName + " - " + current.SiteSettings.SiteDescription, HiContext.Current.Context);
        }
コード例 #20
0
        protected override void Render(HtmlTextWriter writer)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       domainName     = Globals.DomainName;
            string       text           = HttpContext.Current.Request.UserAgent;
            bool         flag           = false;

            flag = (masterSettings.OpenWap == 1 && true);
            if (string.IsNullOrEmpty(text))
            {
                text = "";
            }
            if (text.ToLower().IndexOf("micromessenger") > -1 && masterSettings.OpenVstore == 1)
            {
                flag = true;
            }
            HiContext current = HiContext.Current;
            bool      flag2   = false;

            if (masterSettings.OpenMultStore)
            {
                flag2 = true;
            }
            string imageServerUrl = Globals.GetImageServerUrl();

            writer.Write("<script language=\"javascript\" type=\"text/javascript\"> \r\n                                var HasWapRight = {0};\r\n                                var IsOpenStores = {1};\r\n                                var ClientPath = \"{2}\";\r\n                                var ImageServerUrl = \"{3}\";\r\n                                var ImageUploadPath = \"{4}\";\r\n                                var StoreDefaultPage = \"{5}\";\r\n                                var qqMapAPIKey = \"{6}\";\r\n                            </script>", flag ? "true" : "false", flag2.ToString().ToLower(), HiContext.Current.GetClientPath, imageServerUrl, string.IsNullOrEmpty(imageServerUrl) ? "/admin/UploadHandler.ashx?action=newupload" : "/admin/UploadHandler.ashx?action=remoteupdateimages", masterSettings.Store_PositionRouteTo, string.IsNullOrEmpty(masterSettings.QQMapAPIKey) ? "SYJBZ-DSLR3-IWX3Q-3XNTM-ELURH-23FTP" : masterSettings.QQMapAPIKey);
            string text2 = HttpContext.Current.Request.Url.ToString().ToLower();

            if ((text2.Contains("/groupbuyproductdetails") || text2.Contains("/countdownproductsdetails") || (text2.Contains("/productdetails") && !text2.Contains("/appshop")) || text2.Contains("/membercenter") || text2.Contains("/membergroupdetails") || text2.Contains("/membergroupdetailsstatus") || text2.Contains("/fightgroupactivitydetails") || text2.Contains("/fightgroupactivitydetailssoon") || text2.Contains("/fightgroupdetails") || text2.Contains("/productlist") || text2.Contains("/default") || text2.Contains("/storehome") || text2.Contains("/storelist") || text2.Contains("/storeproductdetails") || text2.Contains("/presaleproductdetails") || text2.Contains("countdownstoreproductsdetails")) && masterSettings.MeiQiaActivated == "1")
            {
                string     empty     = string.Empty;
                string     empty2    = string.Empty;
                int        productId = 0;
                string     text3     = masterSettings.MeiQiaUnitid.ToNullString();
                string     text4     = string.Empty;
                string     text5     = string.Empty;
                string     empty3    = string.Empty;
                string     text6     = string.Empty;
                string     empty4    = string.Empty;
                string     empty5    = string.Empty;
                string     empty6    = string.Empty;
                string     empty7    = string.Empty;
                string     empty8    = string.Empty;
                string     text7     = string.Empty;
                string     text8     = string.Empty;
                string     text9     = string.Empty;
                string     text10    = string.Empty;
                string     empty9    = string.Empty;
                string     empty10   = string.Empty;
                string     text11    = string.Empty;
                string     text12    = string.Empty;
                string     text13    = string.Empty;
                string     text14    = string.Empty;
                string     text15    = string.Empty;
                MemberInfo user      = HiContext.Current.User;
                if (user != null)
                {
                    text4  = user.RealName.ToNullString();
                    empty8 = text4;
                    empty7 = user.UserName.ToNullString();
                    empty5 = ((user.Picture == null) ? "" : (masterSettings.SiteUrl + user.Picture));
                    text5  = ((user.Gender != Gender.Female) ? ((user.Gender != Gender.Male) ? "保密" : "男") : "女");
                    empty3 = user.BirthDate.ToNullString();
                    object obj;
                    if (!user.BirthDate.HasValue)
                    {
                        obj = "";
                    }
                    else
                    {
                        DateTime dateTime = DateTime.Now;
                        int      year     = dateTime.Year;
                        dateTime = user.BirthDate.Value;
                        obj      = (year - dateTime.Year).ToString();
                    }
                    text6  = (string)obj;
                    text7  = user.CellPhone.ToNullString();
                    text8  = user.Email.ToNullString();
                    text9  = RegionHelper.GetFullRegion(user.RegionId, "", true, 0) + user.Address;
                    text10 = user.QQ.ToNullString();
                    text11 = user.WeChat.ToNullString();
                    text12 = user.Wangwang.ToNullString();
                    DateTime createDate = user.CreateDate;
                    text13 = ((user.CreateDate < new DateTime(1000, 1, 1)) ? "" : user.CreateDate.ToNullString());
                    MemberGradeInfo memberGrade = MemberHelper.GetMemberGrade(user.GradeId);
                    text14 = ((memberGrade == null) ? "" : memberGrade.Name.ToNullString());
                }
                if (int.TryParse(this.Page.Request.QueryString["productId"], out productId))
                {
                    SiteSettings masterSettings2   = SettingsManager.GetMasterSettings();
                    ProductInfo  productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId);
                    if (productSimpleInfo != null && productSimpleInfo.SaleStatus != 0)
                    {
                        text15 = ",'商品名称': '{0}'\r\n                                    ,'售价': '{1}'\r\n                                    ,'市场价': '{2}'\r\n                                    ,'品牌': '{3}'\r\n                                    ,'商品编号': '{4}'\r\n                                    ,'商品货号': '{5}'\r\n                                    ,'浏览次数': '{6}'\r\n                                    ,'重量': '{7}'\r\n                                    ,'已经出售': '{8}'";
                        string empty11 = string.Empty;
                        empty11 = ((!(productSimpleInfo.MinSalePrice == productSimpleInfo.MaxSalePrice)) ? (productSimpleInfo.MinSalePrice.F2ToString("f2") + " - " + productSimpleInfo.MaxSalePrice.F2ToString("f2")) : productSimpleInfo.MinSalePrice.F2ToString("f2"));
                        string empty12 = string.Empty;
                        empty12 = ((!(productSimpleInfo.Weight > decimal.Zero)) ? "无" : string.Format("{0} g", productSimpleInfo.Weight.F2ToString("f2")));
                        string obj2 = string.Empty;
                        if (productSimpleInfo.BrandId.HasValue)
                        {
                            BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productSimpleInfo.BrandId.Value);
                            if (brandCategory != null)
                            {
                                obj2 = brandCategory.BrandName;
                            }
                        }
                        text15 = string.Format(text15, productSimpleInfo.ProductName.ToNullString(), empty11, productSimpleInfo.MarketPrice.ToNullString(), obj2.ToNullString(), productSimpleInfo.ProductCode.ToNullString(), productSimpleInfo.SKU.ToNullString(), productSimpleInfo.VistiCounts.ToNullString(), empty12, productSimpleInfo.ShowSaleCounts.ToNullString());
                    }
                }
                empty = "<script type='text/javascript'>\r\n                                    (function (m, ei, q, i, a, j, s) {\r\n                                        m[a] = m[a] || function () {\r\n                                            (m[a].a = m[a].a || []).push(arguments)\r\n                                        };\r\n                                        j = ei.createElement(q),\r\n                                            s = ei.getElementsByTagName(q)[0];\r\n                                        j.async = true;\r\n                                        j.charset = 'UTF-8';\r\n                                        j.src = i;\r\n                                        s.parentNode.insertBefore(j, s)\r\n                                    })(window, document, 'script', '//eco-api.meiqia.com/dist/meiqia.js', '_MEIQIA');\r\n                                    _MEIQIA('entId', " + text3 + ");\r\n                                    _MEIQIA('metadata', { \r\n                                                address: '" + text9 + "', // 地址\r\n                                                age: '" + text6 + "', // 年龄\r\n                                                comment: '" + empty6 + "', // 备注\r\n                                                email: '" + text8 + "', // 邮箱\r\n                                                gender: '" + text5 + "', // 性别\r\n                                                name: '" + text4 + "', // 名字\r\n                                                qq: '" + text10 + "', // QQ\r\n                                                tel: '" + text7 + "', // 电话\r\n                                                weibo: '" + empty9 + "', // 微博\r\n                                                weixin: '" + empty10 + "', // 微信 \r\n                                                '会员等级': '" + text14 + "',\r\n                                                'MSN': '" + text11 + "',\r\n                                                '旺旺': '" + text12 + "',\r\n                                                '账号创建时间': '" + text13 + "' " + text15 + "\r\n                                    });\r\n                                </script>";
                writer.Write(empty);
            }
            writer.WriteLine();
        }
コード例 #21
0
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            HttpCookie cookie;
            string     str2;

            this.parameters.Add("CurrentOpenId", e.OpenId);
            HiContext current            = HiContext.Current;
            string    usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, this.openIdType);

            if (string.IsNullOrEmpty(usernameWithOpenId))
            {
                string str3 = this.openIdType.ToLower();
                if (str3 == null)
                {
                    goto Label_024D;
                }
                if (!(str3 == "hishop.plugins.openid.alipay.alipayservice"))
                {
                    if (str3 == "hishop.plugins.openid.qq.qqservice")
                    {
                        this.SkipQQOpenId();
                        goto Label_0267;
                    }
                    if (str3 == "hishop.plugins.openid.taobao.taobaoservice")
                    {
                        this.SkipTaoBaoOpenId();
                        goto Label_0267;
                    }
                    if (str3 == "hishop.plugins.openid.sina.sinaservice")
                    {
                        this.SkipSinaOpenId();
                        goto Label_0267;
                    }
                    goto Label_024D;
                }
                this.SkipAlipayOpenId();
                goto Label_0267;
            }
            Member member = Users.GetUser(0, usernameWithOpenId, false, true) as Member;

            if (member == null)
            {
                base.Response.Write("登录失败,信任登录只能用于会员登录。");
                return;
            }
            if (HiContext.Current.SiteSettings.IsDistributorSettings)
            {
                if (member.ParentUserId.HasValue)
                {
                    if (member.ParentUserId.Value == HiContext.Current.SiteSettings.UserId)
                    {
                        goto Label_00FE;
                    }
                }
                base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。");
                return;
            }
            if (member.ParentUserId.HasValue && (member.ParentUserId.Value != 0))
            {
                base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。");
                return;
            }
Label_00FE:
            cookie = FormsAuthentication.GetAuthCookie(member.Username, false);
            member.GetUserCookie().WriteCookie(cookie, 30, false);
            HiContext.Current.User = member;
            ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart();

            CookieShoppingProvider.Instance().ClearShoppingCart();
            current.User = member;
            if (shoppingCart != null)
            {
                ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart);
            }
            if (!string.IsNullOrEmpty(this.parameters["token"]))
            {
                HttpCookie cookie3 = new HttpCookie("Token_" + HiContext.Current.User.UserId.ToString());
                cookie3.Expires = DateTime.Now.AddMinutes(30.0);
                cookie3.Value   = this.parameters["token"];
                HttpContext.Current.Response.Cookies.Add(cookie3);
            }
            goto Label_0267;
Label_024D:
            this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
Label_0267:
            str2 = this.parameters["HITO"];
            if (str2 == "1")
            {
                this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder"));
            }
            else
            {
                this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
            }
        }
コード例 #22
0
ファイル: OpenIdEntry.aspx.cs プロジェクト: yuelinsoft/himedi
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            string str;

            parameters.Add("CurrentOpenId", e.OpenId);

            HiContext current = HiContext.Current;

            string usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, openIdType);

            if (!string.IsNullOrEmpty(usernameWithOpenId))
            {
                IUser user = Users.GetUser(0, usernameWithOpenId, false, true);

                if (((user == null) || user.IsAnonymous) || (user.UserRole == UserRole.SiteManager))
                {
                    Response.Write("登录失败,信任登录只能用于会员登录。");

                    return;
                }

                if (user.IsLockedOut)
                {
                    Response.Write("登录失败,您的用户账号还在等待审核。");

                    return;
                }

                HttpCookie authCookie = FormsAuthentication.GetAuthCookie(user.Username, false);

                user.GetUserCookie().WriteCookie(authCookie, 30, false);

                HiContext.Current.User = user;

                ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart();

                CookieShoppingProvider.Instance().ClearShoppingCart();

                current.User = user;

                if (shoppingCart != null)
                {
                    ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart);
                }

                if (!string.IsNullOrEmpty(parameters["token"]))
                {
                    HttpCookie cookie3 = new HttpCookie("Token_" + HiContext.Current.User.UserId.ToString());
                    cookie3.Expires = DateTime.Now.AddMinutes(30.0);
                    cookie3.Value   = parameters["token"];
                    HttpCookie cookie = cookie3;
                    HttpContext.Current.Response.Cookies.Add(cookie);
                }

                goto Label_0214;
            }
            string str3 = openIdType.ToLower();

            if (str3 == null)
            {
                goto Label_01F9;
            }
            if (!(str3 == "hishop.plugins.openid.alipay.alipayservice"))
            {
                if (!(str3 == "hishop.plugins.openid.qq.qqservice"))
                {
                    goto Label_01F9;
                }
                SkipQQOpenId();
            }
            else
            {
                SkipAlipayOpenId();
            }
            goto Label_0214;
Label_01F9:
            Page.Response.Redirect(Globals.GetSiteUrls().Home);
Label_0214:
            str = parameters["HITO"];
            if (str == "1")
            {
                Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder"));
            }
            else
            {
                Page.Response.Redirect(Globals.GetSiteUrls().Home);
            }
        }
コード例 #23
0
        private void Notify_Authenticated(object sender, AuthenticatedEventArgs e)
        {
            bool flag = false;

            if (this.hidToken != null)
            {
                this.hidToken.Value = Globals.StripAllTags(this.parameters["token"]);
            }
            if (this.hidUserId != null)
            {
                this.hidUserId.Value = Globals.StripAllTags(this.parameters["user_id"]);
            }
            if (this.hidEmail != null)
            {
                this.hidEmail.Value = Globals.StripAllTags(this.parameters["email"]);
            }
            string text = "";

            switch (this.openIdType.ToLower())
            {
            case "hishop.plugins.openid.alipay.alipayservice":
                text = (string.IsNullOrEmpty(this.parameters["real_name"]) ? string.Empty : this.parameters["real_name"].ToNullString().Trim());
                break;

            case "hishop.plugins.openid.qq.qqservice":
            {
                HttpCookie httpCookie3 = HttpContext.Current.Request.Cookies["NickName"];
                if (httpCookie3 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie3.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.taobao.taobaoservice":
            {
                HttpCookie httpCookie4 = HttpContext.Current.Request.Cookies["NickName"];
                if (httpCookie4 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie4.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.sina.sinaservice":
            {
                HttpCookie httpCookie2 = HttpContext.Current.Request.Cookies["SinaNickName"];
                if (httpCookie2 != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie2.Value).Trim();
                }
                break;
            }

            case "hishop.plugins.openid.weixin.weixinservice":
            {
                HttpCookie httpCookie = HttpContext.Current.Request.Cookies["NickName"];
                if (text != null)
                {
                    text = HttpUtility.UrlDecode(httpCookie.Value).Trim();
                }
                break;
            }

            default:
                this.Page.Response.Redirect("/", true);
                break;
            }
            this.hidRealName.Value = text;
            this.labNickName.Text  = text;
            this.labNickName1.Text = text;
            this.labNickName2.Text = text;
            string text2 = this.Page.Request.QueryString["headimage"].ToNullString();

            if (string.IsNullOrEmpty(text2))
            {
                text2 = "/Templates/common/images/headerimg.png";
            }
            this.userPicture.Src = text2;
            this.parameters.Add("CurrentOpenId", e.OpenId);
            HiContext current = HiContext.Current;

            this.openId = e.OpenId;
            if (!string.IsNullOrEmpty(this.openId))
            {
                HttpCookie httpCookie5 = new HttpCookie("openId");
                httpCookie5.HttpOnly = true;
                httpCookie5.Value    = this.openId;
                httpCookie5.Expires  = DateTime.MaxValue;
                HttpContext.Current.Response.Cookies.Add(httpCookie5);
            }
            MemberInfo memberByOpenId = MemberProcessor.GetMemberByOpenId(this.openIdType, this.openId);

            if (memberByOpenId != null)
            {
                Users.SetCurrentUser(memberByOpenId.UserId, 1, true, false);
                ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart();
                current.User = memberByOpenId;
                if (cookieShoppingCart != null)
                {
                    ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart);
                    ShoppingCartProcessor.ClearCookieShoppingCart();
                }
                if (!string.IsNullOrEmpty(this.parameters["token"]))
                {
                    HttpCookie httpCookie6 = new HttpCookie("Token_" + HiContext.Current.UserId.ToString());
                    httpCookie6.HttpOnly = true;
                    httpCookie6.Expires  = DateTime.Now.AddMinutes(30.0);
                    httpCookie6.Value    = Globals.StripAllTags(this.parameters["token"]);
                    HttpContext.Current.Response.Cookies.Add(httpCookie6);
                }
            }
            else
            {
                this.AuthMsg = "Auth_Sucess";
            }
        }