예제 #1
0
        public ActionResult PostLogin()
        {
            HttpCookie cookie = Request.Cookies["ghy_sso_token"];

            if (cookie != null)
            {
                string           token        = cookie.Value;
                Hub.Models.Token token_record = AuthentiationStrategy.GetSessionByToken(token, AuthentiationStrategy.CreateCheckCode(Request.UserAgent, Request.UserHostAddress));
                if (token_record != null)
                {
                    Session["User"] = token_record.UserID;
                    return(Redirect(SiteConfig.SiteUrl + "/Home/Index"));
                }
            }
            return(Redirect("http://ghy.cn/ghy_sso/user/login?ReturnUrl=" + SiteConfig.SiteUrl + "/user/login"));
        }
예제 #2
0
        public ActionResult Login()
        {
            string token = Request.QueryString["token"];

            if (token != null)
            {
                HttpCookie cookie = new HttpCookie("ghy_sso_token", token);
                cookie.HttpOnly = true;
                cookie.Expires  = DateTime.Now + TimeSpan.FromDays(30);
                Response.SetCookie(cookie);
            }

            Hub.Models.Token token_record = AuthentiationStrategy.GetSessionByToken(token, AuthentiationStrategy.CreateCheckCode(Request.UserAgent, Request.UserHostAddress));

            if (token_record != null)
            {
                Session["User"] = token_record.UserID;
                return(Redirect(SiteConfig.SiteUrl + "/Home/Index"));
            }
            return(Redirect(SiteConfig.SiteUrl + "/User/PostLogin"));
        }