Exemplo n.º 1
0
        private void Page_Load()
        {
            // check if username exists in the query string
            username            = Request.QueryString["username"];
            sueetieUser         = SueetieUsers.GetUser(username);
            lblDisplayName.Text = sueetieUser.DisplayName;

            SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());

            if (username == null || username == "")
            {
                Response.Redirect("users.aspx");
            }

            // get membership user account based on username sent in query string
            _user            = Membership.GetUser(username, false);
            lastActivitydate = _user.LastActivityDate;

            UserUpdateMessage.Text = "";

            if (_user.IsLockedOut)
            {
                ActionMessage.Visible = true;
                ActionMessage.Text    = "User is locked out.  Use the \"Unlock User\" button to unlock";
            }
            else
            {
                string bannedIntro   = "This user's IP mask (" + SueetieIPHelper.GetIPMask(sueetieUser.IP) + ") is recorded as banned. Click 'Lift Ban on this User' to permit the user to login or create a new account.";
                string unbannedIntro = "User is not banned. Click 'Ban User' to record user's IP mask as banned to thwart attempts to create new site accounts.";
                if (!Page.IsPostBack)
                {
                    if (sueetieUser.IsBanned)
                    {
                        trBan.Visible       = false;
                        lblBannedIntro.Text = bannedIntro;
                    }
                    else
                    {
                        trUnBan.Visible     = false;
                        lblBannedIntro.Text = unbannedIntro;
                    }


                    SueetieUserProfile profile = SueetieUsers.GetSueetieUserProfile(sueetieUser.UserID);

                    txtDisplayName.Text   = profile.DisplayName;
                    chkNewsletter.Checked = profile.Newsletter;
                }

                _user.LastActivityDate = lastActivitydate;
                Membership.UpdateUser(_user);
                _user = Membership.GetUser(username, false);
            }
        }
Exemplo n.º 2
0
        public void BanUser_OnClick(object sender, EventArgs args)
        {
            string mask = SueetieIPHelper.GetIPMask(sueetieUser.IP);

            if (!string.IsNullOrEmpty(sueetieUser.IP))
            {
                SueetieUsers.BanIP(mask);
                BanMsg.Text = "User Masked IP of <b>" + mask + "</b> has been banned.";
            }
            else
            {
                BanMsg.Text = "Currently there is no recorded IP address for this user. No action was taken. IP Addresses are updated upon login and the user may not have logged-in since IP Banning was available. You may find the user's IP in YetAnotherForum yaf_user table.";
            }
        }
Exemplo n.º 3
0
 public void UnBanUser_OnClick(object sender, EventArgs args)
 {
     SueetieUsers.RemoveBannedIP(SueetieIPHelper.GetIPMask(sueetieUser.IP));
     BanMsg.Text = "User IP Address Ban on " + SueetieIPHelper.GetIPMask(sueetieUser.IP) + " has been removed.";
 }