static DiscuzSessionHelper()
 {
     apikey = "64c4b33f389ceb88fd826561a745f667";
     secret = "1c1924468fffa63c91a47e027d8cee2a";
     url    = Fn.GetAppSettings("bbsurl");
     ds     = new DiscuzSession(apikey, secret, url);
 }
 static DiscuzSessionHelper()
 {
     apikey = "64c4b33f389ceb88fd826561a745f667";
     secret = "1c1924468fffa63c91a47e027d8cee2a";
     url    = "http://192.168.1.191:94/";
     ds     = new DiscuzSession(apikey, secret, url);
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ds = DiscuzSessionHelper.GetSession();
            if (!IsPostBack)
            {
                User user;
                try
                {
                    ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
                }
                catch
                {
                    Response.Redirect("SessionCreater.aspx?next=usermanage");
                }
                if (ds.session_info.UId <= 0)
                    Response.Redirect("default.aspx");

                user = ds.GetLoggedInUser().GetUserInfo();
                IDLabel.Text = user.UId.ToString();
                RealNameBox.Text = user.RealName;
                IDNumBox.Text = user.IdCard;
                MobileBox.Text = user.Mobile;
                TelphoneBox.Text = user.Phone;
                GenderBox.Text = user.Gender.ToString();
                NickNameBox.Text = user.NickName;
                EmailBox.Text = user.Email;
                UserIndexBox.Text = user.WebSite;
                LocationBox.Text = user.Location;
                avatarUrl = user.Avatar;
            }
        }
Beispiel #4
0
        public void Login(string loginid, string password, bool isMD5Password, int expires, string cookieDomain)
        {
            DiscuzSession ds  = new DiscuzSession(api, secret, url);
            int           uid = ds.GetUserID(loginid);

            if (uid > 0)
            {
                ds.Login(uid, password, isMD5Password, expires, "www.92acg.cn");
            }
        }
Beispiel #5
0
        static DiscuzSessionHelper()
        {
            String     strXmlFile = System.Web.HttpContext.Current.Server.MapPath("~/_data/config/site.config");
            XmlControl XmlTool    = new XmlControl(strXmlFile);

            apikey = XmlTool.GetText("Root/ForumAPIKey"); //API Key
            secret = XmlTool.GetText("Root/ForumSecret"); //密钥
            url    = XmlTool.GetText("Root/ForumUrl");    //论坛地址
            XmlTool.Dispose();
            ds = new DiscuzSession(apikey, secret, url);
        }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ds = DiscuzSessionHelper.GetSession();
     try
     {
         ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
     }
     catch
     {
         Response.Redirect("SessionCreater.aspx?next=msgop");
     }
 }
Beispiel #7
0
        public void EditPassword(string username, string newMD5Password)
        {
            DiscuzSession ds  = new DiscuzSession(api, secret, url);
            int           uid = ds.GetUserID(username);

            if (uid > 0)
            {
                UserForEditing ufe = new UserForEditing();
                ufe.Password = newMD5Password;
                ds.SetUserInfo(uid, ufe);
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ds = WebSampleHelper.DiscuzSessionHelper.GetSession();
     try
     {
         ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
     }
     catch
     {
         Response.Redirect("SessionCreater.aspx?next=forummanage");
     }
     status = CHECKED;
     if (IsPostBack)
         initCheck();
 }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ds = DiscuzSessionHelper.GetSession();
     try
     {
         ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
     }
     catch
     {
         Response.Redirect("SessionCreater.aspx?next=topicmanage");
     }
     if (uid != null && uid.Trim() == "-1")
     {
         uid = "";
     }
 }
Beispiel #10
0
 //验证当前的AuthToken是否可用
 public bool ValidateAuthToken(DiscuzSession ds, ref int Errorcode)
 {
     try
     {
         ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
         Errorcode = 0;
         return true;
     }
     catch (DiscuzException d)
     {
         Errorcode = d.ErrorCode;
         return false;
     }
     catch (NullReferenceException)
     {
         Errorcode = 0;
         return false;
     }
 }
Beispiel #11
0
        private void LoginCommunity(EyouSoft.SSOComponent.Entity.UserInfo UserModel)
        {
            int num = 100;

            try
            {
                DiscuzSession       session = DiscuzSessionHelper.GetSession();
                int                 userID  = session.GetUserID(UserModel.UserName);
                string              str     = "tongye114.com";
                NameValueCollection section = (NameValueCollection)ConfigurationManager.GetSection("DiscuzAPI");
                if (section != null)
                {
                    str = string.IsNullOrEmpty(section["CookieDomain"]) ? "tongye114.com" : section["CookieDomain"];
                    num = string.IsNullOrEmpty(section["CookieExpires"]) ? 100 : int.Parse(section["CookieExpires"]);
                }
                session.Login(userID, UserModel.PassWordInfo.NoEncryptPassword, false, num, str);
            }
            catch (Exception e) { }
        }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["dnt"] == null)
     {
         unlogin.Visible = true;
         ds = DiscuzSessionHelper.GetSession();
     }
     else
     {
         login.Visible = true;
         ds = DiscuzSessionHelper.GetSession();
         try
         {
             ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
         }
         catch
         {
             Response.Redirect("SessionCreater.aspx?next=default");
         }
         userName = ds.GetUserInfo(ds.GetLoggedInUser().UId).UserName;
     }
 }
Beispiel #13
0
 //获取AuthToken
 public void GetAuthToken(string n, DiscuzSession ds)
 {
     Response.Redirect(ds.CreateToken().ToString() + "&next=" + n);
 }
Beispiel #14
0
        public void Register(string username, string password, string email, bool isMD5Password)
        {
            DiscuzSession ds = new DiscuzSession(api, secret, url);

            ds.Register(username, password, email, isMD5Password);
        }
Beispiel #15
0
        public int IsUserExits(string loginid)
        {
            DiscuzSession ds = new DiscuzSession(api, secret, url);

            return(ds.GetUserID(loginid));
        }
Beispiel #16
0
        public void Logout(string cookieDomain)
        {
            DiscuzSession ds = new DiscuzSession(api, secret, url);

            ds.Logout("92acg.cn");
        }