Example #1
0
    private string CheckCookie()
    {
        CookieHelper cookie   = new CookieHelper(Context);
        string       userName = cookie.GetCookieValue("RememberMe");

        if (!string.IsNullOrEmpty(userName))
        {
            string token = cookie.GetCookieValue("LoginToken");
            if (string.IsNullOrEmpty(token))
            {
                return(userName);
            }
            else
            {
                UserInfo user = new UserInfo();
                user.userName = userName;
                string value = UserInfoManage.CookieLogin(ref user, token);
                if (value == "登录成功")
                {
                    Session["user"] = user;
                    List <DepartmentPost> dpList = UserInfoManage.GetDepartmentPostList(user);
                    Session["DepartmentPostList"] = dpList;
                    return("T");
                }
                else
                {
                    return(userName);
                }
            }
        }
        else
        {
            return("");
        }
    }