Пример #1
0
        protected void btnUnlockUser_Click(object sender, EventArgs e)
        {
            if (this.userID > -1)
            {
                SiteUser user = new SiteUser(siteSettings, this.userID);
                user.UnlockAccount();
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
            return;
        }
        public override bool UnlockUser(string userName)
        {
            /*
             Unlocks (that is, restores login privileges for) the specified user. UnlockUser returns true if the
             * user is successfully unlocked. Otherwise, it returns false. If the user is already unlocked,
             * UnlockUser simply returns true.
             */
            SiteSettings siteSettings = GetSiteSettings();

            bool result = false;
            if ((siteSettings != null) && (userName != null) && (userName.Length > 0))
            {
                SiteUser siteUser = new SiteUser(siteSettings, userName);
                if (siteUser.UserId > 0)
                {
                    if (!siteUser.IsLockedOut)
                    {
                        result = true;
                    }
                    else
                    {
                        result = siteUser.UnlockAccount();
                    }

                }

            }

            return result;
        }