예제 #1
0
        protected override void ShowPage()
        {
            int logoutUid = userid;

            pagetitle = "用户退出";
            username  = "******";
            userid    = -1;

            base.AddScript("if (top.document.getElementById('leftmenu')){ top.frames['leftmenu'].location.reload(); }");

            if (!DNTRequest.IsPost() || reurl != "")
            {
                string r = (!Utils.StrIsNullOrEmpty(reurl)) ? reurl : "";

                if (reurl == "")
                {
                    r = (DNTRequest.GetUrlReferrer() == "" || DNTRequest.GetUrlReferrer().IndexOf("login") > -1 || DNTRequest.GetUrlReferrer().IndexOf("logout") > -1) ?
                        "index.aspx" : DNTRequest.GetUrlReferrer();
                }

                Utils.WriteCookie("reurl", (reurl == "" || reurl.IndexOf("login.aspx") > -1) ? r : reurl);
            }

            if (DNTRequest.GetString("userkey") == userkey || IsApplicationLogout())
            {
                AddMsgLine("已经清除了您的登录信息, 稍后您将以游客身份返回首页");

                OnlineUsers.DeleteRows(olid);
                ForumUtils.ClearUserCookie();
                Utils.WriteCookie(Utils.GetTemplateCookieName(), "", -999999);

                System.Web.HttpContext.Current.Response.AppendCookie(new System.Web.HttpCookie("dntadmin"));

                //同步登录到第三方应用
                if (APIConfigs.GetConfig().Enable)
                {
                    AddMsgLine(Sync.GetLogoutScript(logoutUid));
                }

                if (!APIConfigs.GetConfig().Enable || !Sync.NeedAsyncLogout())
                {
                    MsgForward("logout_succeed");
                }
            }
            else
            {
                AddMsgLine("无法确定您的身份, 稍后返回首页");
            }

            SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl()));
            SetMetaRefresh();
            SetShowBackLink(false);
        }
예제 #2
0
        protected override void ShowPage()
        {
            pagetitle = "用户帐号激活";

            SetUrl("index.aspx");
            SetMetaRefresh();
            SetShowBackLink(false);

            string authstr = Utils.HtmlEncode(DNTRequest.GetString("authstr").Trim()).Replace("'", "''");

            if (authstr != null && authstr != "")
            {
                DataTable dt = Discuz.Forum.Users.GetUserIdByAuthStr(authstr);
                if (dt.Rows.Count > 0)
                {
                    int uid = Convert.ToInt32(dt.Rows[0][0].ToString());

                    //将用户调整到相应的用户组
                    if (UserCredits.GetCreditsUserGroupID(0) != null)
                    {
                        int tmpGroupID = UserCredits.GetCreditsUserGroupID(0).Groupid;                         //添加注册用户审核机制后需要修改
                        Discuz.Forum.Users.UpdateUserGroup(uid, tmpGroupID);
                    }

                    //更新激活字段
                    Discuz.Forum.Users.UpdateAuthStr(uid, "", 0);

                    AddMsgLine("您当前的帐号已经激活,稍后您将以相应身份返回首页");

                    ForumUtils.WriteUserCookie(uid, Utils.StrToInt(DNTRequest.GetString("expires"), -1), config.Passwordkey);
                    OnlineUsers.UpdateAction(olid, UserAction.ActivationUser.ActionID, 0, config.Onlinetimeout);
                }
                else
                {
                    AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页");
                    OnlineUsers.DeleteRows(olid);
                    ForumUtils.ClearUserCookie();
                }
            }
            else
            {
                AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页");
                OnlineUsers.DeleteRows(olid);
                ForumUtils.ClearUserCookie();
            }
        }
예제 #3
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            string referer = HTTPRequest.GetQueryString("reurl");

            if (!HTTPRequest.IsPost() || referer != "")
            {
                string r = "";
                if (referer != "")
                {
                    r = referer;
                }
                else
                {
                    if ((HTTPRequest.GetUrlReferrer() == "") || (HTTPRequest.GetUrlReferrer().IndexOf("login") > -1) ||
                        HTTPRequest.GetUrlReferrer().IndexOf("logout") > -1)
                    {
                        r = "Default.aspx";
                    }
                    else
                    {
                        r = HTTPRequest.GetUrlReferrer();
                    }
                }
                Utils.WriteCookie("reurl", (referer == "" || referer.IndexOf("login.aspx") > -1) ? r : referer);
            }


            SetUrl(Utils.UrlDecode(UsersUtils.GetReUrl()));

            SetMetaRefresh();
            SetShowBackLink(false);

            tbUserInfo.UpdateUserOnlineTime(userid, DateTime.Now.ToString());
            OnlineUsers.DeleteRows(olid);
            UsersUtils.ClearUserCookie();
            this.userid = 0;

            AddMsgLine("已经清除了您的登录信息");
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //更新在线表相关用户信息
            config = GeneralConfigs.GetConfig();
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            if (AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid).Radminid != 1)
            {
                HttpContext.Current.Response.Redirect("../");
                return;
            }
            int olid = oluserinfo.Olid;

            OnlineUsers.DeleteRows(olid);

            //清除Cookie
            ForumUtils.ClearUserCookie();
            HttpCookie cookie = new HttpCookie("dntadmin");

            HttpContext.Current.Response.AppendCookie(cookie);

            FormsAuthentication.SignOut();
        }
예제 #5
0
        protected override void ShowPage()
        {
            pagetitle = "用户帐号激活";

            SetUrl("index.aspx");
            SetMetaRefresh();
            SetShowBackLink(false);

            string authStr = Utils.HtmlEncode(DNTRequest.GetString("authstr").Trim()).Replace("'", "''");

            if (!Utils.StrIsNullOrEmpty(authStr))
            {
                if (Users.UpdateAuthStr(authStr))
                {
                    AddMsgLine("您当前的帐号已经激活,稍后您将以相应身份返回首页");

                    OnlineUsers.UpdateAction(olid, UserAction.ActivationUser.ActionID, 0, config.Onlinetimeout);
                    return;
                }
            }
            AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页");
            OnlineUsers.DeleteRows(olid);
            ForumUtils.ClearUserCookie();
        }
예제 #6
0
        protected override void ShowPage()
        {
            pagetitle = "用户退出";
            username  = "******";
            int uid = userid;

            userid = -2;
            StringBuilder script = new StringBuilder();

            script.Append("if (top.document.getElementById('leftmenu')){");
            script.Append("		top.frames['leftmenu'].location.reload();");
            script.Append("}");

            base.AddScript(script.ToString());

            string referer = DNTRequest.GetQueryString("reurl");

            if (!DNTRequest.IsPost() || referer != "")
            {
                string r = "";
                if (referer != "")
                {
                    r = referer;
                }
                else
                {
                    if ((DNTRequest.GetUrlReferrer() == "") || (DNTRequest.GetUrlReferrer().IndexOf("login") > -1) ||
                        DNTRequest.GetUrlReferrer().IndexOf("logout") > -1)
                    {
                        r = "index.aspx";
                    }
                    else
                    {
                        r = DNTRequest.GetUrlReferrer();
                    }
                }
                Utils.WriteCookie("reurl", (referer == "" || referer.IndexOf("login.aspx") > -1) ? r : referer);
            }


            SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl()));

            SetMetaRefresh();
            SetShowBackLink(false);
            if (DNTRequest.GetString("userkey") == userkey || IsApplicationLogout())
            {
                AddMsgLine("已经清除了您的登录信息, 稍后您将以游客身份返回首页");
                //Users.UpdateOnlineTime(uid);
                OnlineUsers.DeleteRows(olid);
                ForumUtils.ClearUserCookie();
                Utils.WriteCookie(Utils.GetTemplateCookieName(), "", -999999);

                System.Web.HttpCookie cookie = new System.Web.HttpCookie("dntadmin");
                System.Web.HttpContext.Current.Response.AppendCookie(cookie);

                //System.Web.Security.FormsAuthentication.SignOut();
            }
            else
            {
                AddMsgLine("无法确定您的身份, 稍后返回首页");
            }

            Discuz.Forum.Users.RemoveUserIDFromCookie();
        }