Example #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (this.Context.Request.IsAuthenticated)
            {
                System.Web.Security.FormsAuthentication.SignOut();
                System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
                Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
                if (userCookie != null)
                {
                    userCookie.DeleteCookie(authCookie);
                }
                Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
            }
            string text = base.Request.QueryString["ot"];

            if (OpenIdPlugins.Instance().GetPluginItem(text) == null)
            {
                this.lblMsg.Text = "没有找到对应的插件,<a href=\"" + Globals.GetSiteUrls().Home + "\">返回首页</a>。";
                return;
            }
            OpenIdSettingsInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text);

            if (openIdSettings == null)
            {
                this.lblMsg.Text = "请先配置此插件所需的信息,<a href=\"" + Globals.GetSiteUrls().Home + "\">返回首页</a>。";
                return;
            }
            string returnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("OpenIdEntry_url", new object[]
            {
                text
            }));
            OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl);

            openIdService.Post();
        }
Example #2
0
 protected override void AttachChildControls()
 {
     if (this.Context.Request.IsAuthenticated)
     {
         System.Web.Security.FormsAuthentication.SignOut();
         System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
         Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
         if (userCookie != null)
         {
             userCookie.DeleteCookie(authCookie);
         }
         Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
     }
     if (!string.IsNullOrEmpty(this.Page.Request["action"]) && this.Page.Request["action"] == "Common_UserLogin")
     {
         string text  = this.UserLogin(this.Page.Request["username"], this.Page.Request["password"]);
         string text2 = string.IsNullOrEmpty(text) ? "Succes" : "Fail";
         this.Page.Response.Clear();
         this.Page.Response.ContentType = "application/json";
         this.Page.Response.Write(string.Concat(new string[]
         {
             "{\"Status\":\"",
             text2,
             "\",\"Msg\":\"",
             text,
             "\"}"
         }));
         this.Page.Response.End();
     }
     this.txtUserName = (System.Web.UI.WebControls.TextBox) this.FindControl("txtUserName");
     this.txtPassword = (System.Web.UI.WebControls.TextBox) this.FindControl("txtPassword");
     this.btnLogin    = ButtonManager.Create(this.FindControl("btnLogin"));
     this.ddlPlugins  = (System.Web.UI.WebControls.DropDownList) this.FindControl("ddlPlugins");
     if (this.ddlPlugins != null)
     {
         this.ddlPlugins.Items.Add(new System.Web.UI.WebControls.ListItem("请选择登录方式", ""));
         System.Collections.Generic.IList <OpenIdSettingsInfo> configedItems = MemberProcessor.GetConfigedItems();
         if (configedItems != null && configedItems.Count > 0)
         {
             foreach (OpenIdSettingsInfo current in configedItems)
             {
                 this.ddlPlugins.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.OpenIdType));
             }
         }
         this.ddlPlugins.SelectedIndexChanged += new System.EventHandler(this.ddlPlugins_SelectedIndexChanged);
     }
     if (this.Page.Request.UrlReferrer != null && !string.IsNullOrEmpty(this.Page.Request.UrlReferrer.OriginalString))
     {
         Login.ReturnURL = this.Page.Request.UrlReferrer.OriginalString;
     }
     this.txtUserName.Focus();
     PageTitle.AddSiteNameTitle("用户登录", Hidistro.Membership.Context.HiContext.Current.Context);
     this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
 }
Example #3
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     System.Web.Security.FormsAuthentication.SignOut();
     System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
     Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
     if (userCookie != null)
     {
         userCookie.DeleteCookie(authCookie);
     }
     Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
     base.Response.Redirect("Login.aspx", true);
 }
Example #4
0
 protected override void OnInit(System.EventArgs e)
 {
     if (this.Page.Request.IsAuthenticated)
     {
         System.Web.Security.FormsAuthentication.SignOut();
         System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
         Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
         if (userCookie != null)
         {
             userCookie.DeleteCookie(authCookie);
         }
         Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
     }
     base.OnInit(e);
 }
Example #5
0
 protected override void AttachChildControls()
 {
     Hidistro.Membership.Context.HiContext arg_05_0 = Hidistro.Membership.Context.HiContext.Current;
     if (this.Context.Request.IsAuthenticated)
     {
         System.Web.Security.FormsAuthentication.SignOut();
         System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
         Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
         if (userCookie != null)
         {
             userCookie.DeleteCookie(authCookie);
         }
         Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
         this.Page.Response.Cookies["hishopLoginStatus"].Value = "";
     }
     this.txtUserName     = (System.Web.UI.WebControls.TextBox) this.FindControl("txtUserName");
     this.txtPassword     = (System.Web.UI.WebControls.TextBox) this.FindControl("txtPassword");
     this.btnLogin        = (System.Web.UI.WebControls.Button) this.FindControl("btnLogin");
     this.txtCode         = (System.Web.UI.WebControls.TextBox) this.FindControl("txtCode");
     this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
 }
Example #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (this.Context.Request.IsAuthenticated)
            {
                System.Web.Security.FormsAuthentication.SignOut();
                System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
                Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
                if (userCookie != null)
                {
                    userCookie.DeleteCookie(authCookie);
                }
                Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
            }
            this.openIdType = this.Page.Request.QueryString["HIGW"];
            OpenIdSettingsInfo openIdSettings = MemberProcessor.GetOpenIdSettings(this.openIdType);

            if (openIdSettings == null)
            {
                base.Response.Write("登录失败,没有找到对应的插件配置信息。");
                return;
            }
            this.parameters = new System.Collections.Specialized.NameValueCollection
            {
                this.Page.Request.Form,
                this.Page.Request.QueryString
            };
            OpenIdNotify openIdNotify = OpenIdNotify.CreateInstance(this.openIdType, this.parameters);

            openIdNotify.Authenticated += new System.EventHandler <AuthenticatedEventArgs>(this.Notify_Authenticated);
            openIdNotify.Failed        += new System.EventHandler <FailedEventArgs>(this.Notify_Failed);
            try
            {
                openIdNotify.Verify(30000, HiCryptographer.Decrypt(openIdSettings.Settings));
            }
            catch
            {
                this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
            }
        }
Example #7
0
 protected override void OnLoad(System.EventArgs eventArgs_0)
 {
     base.OnLoad(eventArgs_0);
     System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
     if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
     {
         httpCookie.Expires = System.DateTime.Now;
         System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
     }
     if (this.Context.Request.IsAuthenticated)
     {
         System.Web.Security.FormsAuthentication.SignOut();
         System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(Hidistro.Membership.Context.HiContext.Current.User.Username, true);
         Hidistro.Membership.Core.IUserCookie userCookie = Hidistro.Membership.Context.HiContext.Current.User.GetUserCookie();
         if (userCookie != null)
         {
             userCookie.DeleteCookie(authCookie);
         }
         Hidistro.Membership.Core.RoleHelper.SignOut(Hidistro.Membership.Context.HiContext.Current.User.Username);
         this.Context.Response.Cookies["hishopLoginStatus"].Value = "";
     }
     this.Context.Response.Redirect(Globals.GetSiteUrls().Home, true);
 }