Beispiel #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;
        }
Beispiel #2
0
        public UpdateUserDialog(string url, string application, string user)
        {
            InitializeComponent();

            m_Url                  = url;
            m_Application          = application;
            m_UserNameTextBox.Text = user;

            IMembershipManager membershipManager = UserManagerProviderFactory.CreateMembershipManager(); // new AspNetSqlProviderService(m_Url);
            UserInfo           info = membershipManager.GetUserInfo(m_Application, m_UserNameTextBox.Text);

            m_EmailTextBox.Text          = info.Email;
            m_ActiveUserCheckbox.Checked = info.IsApproved;
            m_LcokedOutCheckBox.Checked  = info.IsLockedOut;

            m_NewQuestionTextBox.Text = m_OldQuestionTextBox.Text = info.PasswordQuestion;

            IPasswordManager passwordManager = membershipManager as IPasswordManager;

            m_OldAnswerTextBox.Enabled   = passwordManager.EnablePasswordRetrieval(application);
            m_NewQuestionTextBox.Enabled = m_NewAnswerTextBox.Enabled = m_OldAnswerTextBox.Enabled;
        }