예제 #1
0
 /// <summary>
 /// 用户登陆(分站点使用)
 /// </summary>
 /// <param name="UserName">用户名</param>
 /// <param name="PWD">密码(密码为空时,直接获取已登录用户信息)</param>
 /// <param name="Token">登录票据</param>
 public bool RemoteUserLogin(string UserName, string PWD, string Token)
 {
     EyouSoft.SSOComponent.Entity.SSOResponse response = null;
     if (PWD != string.Empty)
     {
         response = new EyouSoft.SSOComponent.Remote.UserLogin().UserLoginPassword(UserName, PWD, Token, PasswordType.MD5);
     }
     else
     {
         response = new EyouSoft.SSOComponent.Remote.UserLogin().GetTicketUser(UserName, Token);
     }
     if (response.IsValid)
     {
         EyouSoft.SSOComponent.Entity.UserInfo User = response.UserInfo;
         if (User == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
 /// <summary>
 /// 更新用户信息
 /// </summary>
 public void UpdateUser(EyouSoft.SSOComponent.Entity.UserInfo User)
 {
     if (User != null)
     {
         new EyouSoft.SSOComponent.UserLogin().UpdateUserInfo(User);
     }
 }
예제 #3
0
 /// <summary>
 /// 更新用户信息
 /// </summary>
 public void UpdateUser(EyouSoft.SSOComponent.Entity.UserInfo User)
 {
     if (User != null)
     {
         SSOResponse response = new SSOResponse();
         response.UserInfo = User;
         new EyouSoft.SSOComponent.Remote.UserLogin().UpdateUserInfo(response);
     }
 }
예제 #4
0
 /// <summary>
 /// 用户登陆
 /// </summary>
 /// <param name="UserName">用户名</param>
 /// <param name="PWD">密码</param>
 public bool UserLogin(string UserName, string PWD, string Token, out EyouSoft.SSOComponent.Entity.UserInfo User)
 {
     User = new EyouSoft.SSOComponent.UserLogin().UserLoginAct(UserName, PWD, Token, PasswordType.MD5);
     if (User == null)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #5
0
        /// <summary>
        /// API用户登陆
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="PWD">密码</param>
        /// <param name="PwdType">密码类型</param>
        public void APIUserLogin(string UserName, string PWD, PasswordType PwdType)
        {
            EyouSoft.SSOComponent.Entity.DecryptLoginTicket LoginTicket = new EyouSoft.SSOComponent.Entity.DecryptLoginTicket();
            LoginTicket.ExpireTime = DateTime.Now.AddHours(TicketExpireTime);
            LoginTicket.UserName   = UserName;
            string strLoginTicket = CreateLoginTicket(LoginTicket);

            EyouSoft.SSOComponent.Entity.SSOResponse response = new EyouSoft.SSOComponent.Remote.UserLogin().UserLoginPassword(UserName, PWD, strLoginTicket, PwdType);
            if (response != null)
            {
                if (!response.IsValid)
                {
                    return;
                }
                EyouSoft.SSOComponent.Entity.UserInfo User = response.UserInfo;
                HttpCookie hc = new HttpCookie(UserCookieName);
                hc.Values.Add("UID", crypto.DESEncrypt(User.ID.ToString()));
                hc.Values.Add("LoginTicket", strLoginTicket);
                hc.Domain = "asdf";
                HttpContext.Current.Response.Cookies.Add(hc);
            }
        }
예제 #6
0
 /// <summary>
 /// 验证用户
 /// </summary>
 /// <param name="User">用户信息</param>
 /// <returns></returns>
 private bool ValidateUser(EyouSoft.SSOComponent.Entity.UserInfo User)
 {
     try
     {
         if (User == null)
         {
             return(false);
         }
         EyouSoft.SSOComponent.Entity.LocalUserInfo LocalUser = GetLoginTicket(TicketType.UserCookieName);
         if (LocalUser.LoginTicket == User.LoginTicket)
         {
             if (LocalUser.DecryptLoginTicket.ExpireTime > DateTime.Now ||
                 User.UserName.ToString() != LocalUser.DecryptLoginTicket.UserName)
             {
                 return(false);
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
예제 #7
0
 /// <summary>
 /// 验证用户权限
 /// </summary>
 /// <param name="PermissionID">权限号</param>
 /// <returns></returns>
 public bool CheckGrant(int PermissionID)
 {
     EyouSoft.SSOComponent.Entity.UserInfo User = GetUser();
     return(User.PermissionList.Contains(PermissionID));
 }
예제 #8
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //获取页面请求 类型
            string urlType = EyouSoft.Common.Utils.GetQueryStringValue("urltype");

            if (urlType == "pageajax")
            {
                isAjaxConnect = true;
            }

            //初始化用户信息
            UserInfo userInfo = null;

            _IsLogin  = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo);
            _userInfo = userInfo;

            if (!_IsLogin)//没有登录
            {
                //判断页面请求类型
                if (isAjaxConnect)//是Ajax请求
                {
                    Response.Clear();
                    Response.Write("{Islogin:false}");
                    Response.End();
                }
                else//普通浏览器请求
                {
                    if (this.PageType == PageType.general)
                    {
                        UserProvider.RedirectLogin(Request.Url.ToString());
                    }
                    else
                    {
                        UserProvider.RedirectMinLoginPage(Request.Url.ToString());
                    }
                }
            }
            else//已登录
            {
                //判断当前页面是否属于 专线用户和组团用户共用页面
                bool isShared = EyouSoft.Common.Utils.SharedByTowUsers_URLS.Contains(Request.Url.AbsolutePath.ToLower()) &&
                                (_userInfo.ContactInfo.UserType != EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.地接用户);

                if (isShared == false)//不共用
                {
                    //判断当前登录用户是否是组团用户,
                    //如果不是如果是专线用户则跳回到专线首页
                    //如果是地接用户 则跳转到地接用户的首页
                    if (_userInfo.ContactInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.专线用户)
                    {
                        if (this.PageType == PageType.general)
                        {
                            Response.Redirect("/sanping/default.aspx", true);
                        }
                        else
                        {
                            string script = "<script type='text/javascript'>window.top.location.href ='/sanping/default.aspx';</script> ";
                            Response.Clear();
                            Response.Write(script);
                            Response.End();
                        }
                    }
                    else if (_userInfo.ContactInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.地接用户)
                    {
                        //跳转到地接用户的 个人中心 地接安排 页面
                        if (this.PageType == PageType.general)
                        {
                            Response.Redirect("/UserCenter/DjArrangeMengs/TravelAgencyList.aspx", true);
                        }
                        else
                        {
                            string script = "<script type='text/javascript'>window.top.location.href ='/UserCenter/DjArrangeMengs/TravelAgencyList.aspx';</script> ";
                            Response.Clear();
                            Response.Write(script);
                            Response.End();
                        }
                    }
                }
            }
        }
예제 #9
0
 /// <summary>
 /// 更新用户信息
 /// </summary>
 public void UpdateUser(EyouSoft.Model.CompanyStructure.CompanyUser CompanyUser)
 {
     EyouSoft.SSOComponent.Entity.UserInfo User = GetUser();
     User.ID = CompanyUser.ID;
     //new EyouSoft.SSOComponent.Remote.UserLogin().UpdateUserInfo(User);
 }
예제 #10
0
 /// <summary>
 /// 用户退出
 /// </summary>
 public void UserLogout()
 {
     EyouSoft.SSOComponent.Entity.UserInfo    User     = GetUser();
     EyouSoft.SSOComponent.Entity.SSOResponse response = new EyouSoft.SSOComponent.Remote.UserLogin().UserLogout(User.ID, RedirectUrl);
 }
예제 #11
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            AddMetaContentType();

            //获取页面请求 类型
            string urlType = EyouSoft.Common.Utils.GetQueryStringValue("urltype");

            if (urlType == "pageajax")
            {
                isAjaxConnect = true;
            }

            //初始化用户信息
            UserInfo userInfo = null;

            _IsLogin  = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo);
            _userInfo = userInfo;

            if (!_IsLogin)//没有登录
            {
                //判断页面请求类型
                if (isAjaxConnect)//是Ajax请求
                {
                    Response.Clear();
                    Response.Write("{Islogin:false}");
                    Response.End();
                }
                else//普通浏览器请求
                {
                    if (this.PageType == PageType.general)
                    {
                        UserProvider.RedirectLogin(Request.Url.ToString());
                    }
                    else
                    {
                        //UserProvider.RedirectMinLoginPage(Request.Url.ToString());
                        Response.Clear();
                        Response.Write("<script type='text/javascript'>");
                        Response.Write("if(window.parent.Boxy==undefined||window.parent.Boxy==null){");
                        Response.Write("window.location.href='" + UserProvider.Url_Login + "';");
                        Response.Write("}else{");
                        Response.Write("window.location.href='" + UserProvider.Url_MinLogin + "?returnurl=" + Server.UrlEncode(Request.Url.ToString()) + "';");
                        Response.Write("}");
                        Response.Write("</script>");
                        Response.End();
                    }
                }
            }
            else//已登录
            {
                //判断当前登录用户 是否是 地接用户,如果不是地接用户 则跳转到对应用户类型的相应首页
                if (_userInfo.ContactInfo.UserType != EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.地接用户)
                {
                    if (_userInfo.ContactInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.组团用户)
                    {
                        if (this.PageType == PageType.general)
                        {
                            Response.Redirect("/GroupEnd/Default.aspx", true);
                        }
                        else
                        {
                            string script = "<script>window.top.location.href ='/GroupEnd/Default.aspx';</script> ";
                            Response.Clear();
                            Response.Write(script);
                            Response.End();
                        }
                    }
                    else if (_userInfo.ContactInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.专线用户)
                    {
                        if (this.PageType == PageType.general)
                        {
                            Response.Redirect("/sanping/default.aspx", true);
                        }
                        else
                        {
                            string script = "<script type='text/javascript'>window.top.location.href ='/sanping/default.aspx';</script> ";
                            Response.Clear();
                            Response.Write(script);
                            Response.End();
                        }
                    }
                }
            }
        }
예제 #12
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            AddMetaContentType();

            //获取页面请求 类型
            string urlType = EyouSoft.Common.Utils.GetQueryStringValue("urltype");

            if (urlType == "pageajax")
            {
                isAjaxConnect = true;
            }

            //初始化用户信息
            UserInfo userInfo = null;

            _IsLogin  = EyouSoft.Security.Membership.UserProvider.IsUserLogin(out userInfo);
            _userInfo = userInfo;

            if (!_IsLogin)//没有登录
            {
                //判断页面请求类型
                if (isAjaxConnect)//是Ajax请求
                {
                    Response.Clear();
                    Response.Write("{Islogin:false}");
                    Response.End();
                }
                else//普通浏览器请求
                {
                    if (this.PageType == PageType.general)
                    {
                        UserProvider.RedirectLogin(Request.Url.ToString());
                    }
                    else
                    {
                        //UserProvider.RedirectMinLoginPage(Request.Url.ToString());
                        Response.Clear();
                        Response.Write("<script type='text/javascript'>");
                        Response.Write("if(window.parent.Boxy==undefined||window.parent.Boxy==null){");
                        Response.Write("window.location.href='" + UserProvider.Url_Login + "';");
                        Response.Write("}else{");
                        Response.Write("window.location.href='" + UserProvider.Url_MinLogin + "?returnurl=" + Server.UrlEncode(Request.Url.ToString()) + "';");
                        Response.Write("}");
                        Response.Write("</script>");
                        Response.End();
                    }
                }
            }
            else//已登录
            {
                //判断当前登录用户类型,如果用户类型不是专线用户,则判断当前页面是否是共享使用
                if (_userInfo.UserType != EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.专线用户)     //不是
                {
                    if (_userInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.组团用户) //如果是组团用户
                    {
                        //判断当前页面是否属于 专线用户和组团用户共用页面
                        bool isShared = EyouSoft.Common.Utils.SharedByTowUsers_URLS.Contains(Request.Url.AbsolutePath.ToLower());
                        if (isShared == false)//当前页面不共享
                        {
                            if (this.PageType == PageType.general)
                            {
                                Response.Redirect("/GroupEnd/Default.aspx", true);
                            }
                            else
                            {
                                string script = "<script>window.top.location.href ='/GroupEnd/Default.aspx';</script> ";
                                Response.Clear();
                                Response.Write(script);
                                Response.End();
                            }
                        }
                    }
                    else if (_userInfo.UserType == EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.地接用户)
                    {
                        //判断当前页面是否属于 专线用户和地接用户共用页面
                        bool isShared = EyouSoft.Common.Utils.SharedByAreaConectAndBackUser_URLS.Contains(Request.Url.AbsolutePath.ToLower());
                        if (isShared == false)//当前页面不共享
                        {
                            //跳转到地接用户的 个人中心 地接安排 页面
                            if (this.PageType == PageType.general)
                            {
                                Response.Redirect("/UserCenter/DjArrangeMengs/TravelAgencyList.aspx", true);
                            }
                            else
                            {
                                string script = "<script type='text/javascript'>window.top.location.href ='/UserCenter/DjArrangeMengs/TravelAgencyList.aspx';</script> ";
                                Response.Clear();
                                Response.Write(script);
                                Response.End();
                            }
                        }
                    }
                }
            }
        }