Example #1
0
        void RefreshPasswordsPage()
        {
            if (ApplicationName == String.Empty)
            {
                m_PasswordReset.Text                  = "-";
                m_PasswordRetrieval.Text              = "-";
                m_MaxInvalidAttempts.Text             = "-";
                m_MinNonAlphanumeric.Text             = "-";
                m_MinLength.Text                      = "-";
                m_AttemptWindow.Text                  = "-";
                m_PasswordRegularExpression.Text      = "-";
                m_RequiresQuestionAndAnswerLabel.Text = "-";
                m_LengthTextBox.Text                  = String.Empty;
                m_NonAlphanumericTextBox.Text         = String.Empty;
                m_GeneratePasswordMenuItem.Enabled    = m_GeneratePassword.Enabled = false;
                return;
            }
            m_GeneratePasswordMenuItem.Enabled = m_GeneratePassword.Enabled = true;

            IPasswordManager passwordManager = UserManagerProviderFactory.CreatePasswordManager(); // new AspNetSqlProviderService(ServiceAddress);

            if (passwordManager.EnablePasswordReset(ApplicationName))
            {
                EnablePasswordReset  = true;
                m_PasswordReset.Text = "Yes";
            }
            else
            {
                EnablePasswordReset  = false;
                m_PasswordReset.Text = "No";
            }
            if (passwordManager.EnablePasswordRetrieval(ApplicationName))
            {
                EnablePasswordRetrieval  = true;
                m_PasswordRetrieval.Text = "Yes";
            }
            else
            {
                EnablePasswordRetrieval  = false;
                m_PasswordRetrieval.Text = "No";
            }
            m_MaxInvalidAttempts.Text        = passwordManager.GetMaxInvalidPasswordAttempts(ApplicationName).ToString();
            m_MinNonAlphanumeric.Text        = passwordManager.GetMinRequiredNonAlphanumericCharacters(ApplicationName).ToString();
            m_MinLength.Text                 = passwordManager.GetMinRequiredPasswordLength(ApplicationName).ToString();
            m_AttemptWindow.Text             = passwordManager.GetPasswordAttemptWindow(ApplicationName).ToString();
            m_PasswordRegularExpression.Text = passwordManager.GetPasswordStrengthRegularExpression(ApplicationName);
            if (passwordManager.RequiresQuestionAndAnswer(ApplicationName))
            {
                RequiresQuestionAndAnswer             = true;
                m_RequiresQuestionAndAnswerLabel.Text = "Yes";
            }
            else
            {
                RequiresQuestionAndAnswer             = false;
                m_RequiresQuestionAndAnswerLabel.Text = "No";
            }

            m_LengthTextBox.Text          = m_MinLength.Text;
            m_NonAlphanumericTextBox.Text = m_MinNonAlphanumeric.Text;
        }