Esempio n. 1
0
        void OnCheckedChanged(object sender, EventArgs e)
        {
            if (m_GeneratePasswordCheckBox.Checked)
            {
                using (PasswordManagerProxy passwordManager = new PasswordManagerProxy(m_Url))
                {
                    int    length          = passwordManager.GetMinRequiredPasswordLength(m_Application);
                    int    nonAlphaNumeric = passwordManager.GetMinRequiredNonAlphanumericCharacters(m_Application);
                    string password        = passwordManager.GeneratePassword(m_Application, length, nonAlphaNumeric);
                    m_PasswordTextbox.Text          = password;
                    m_ConfirmedPasswordTextBox.Text = password;

                    m_PasswordTextbox.PasswordChar          = '\0';
                    m_ConfirmedPasswordTextBox.PasswordChar = '\0';
                }
            }
            else
            {
                m_PasswordTextbox.PasswordChar          = '*';
                m_ConfirmedPasswordTextBox.PasswordChar = '*';
            }
        }
        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;

            using (PasswordManagerProxy passwordManager = new PasswordManagerProxy(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;
            }
        }
      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;

         using(PasswordManagerProxy passwordManager = new PasswordManagerProxy(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;
         }
      }
Esempio n. 4
0
      void OnCheckedChanged(object sender,EventArgs e)
      {
         if(m_GeneratePasswordCheckBox.Checked)
         {
            using(PasswordManagerProxy passwordManager = new PasswordManagerProxy(m_Url))
            {
               int length = passwordManager.GetMinRequiredPasswordLength(m_Application);
               int nonAlphaNumeric = passwordManager.GetMinRequiredNonAlphanumericCharacters(m_Application);
               string password = passwordManager.GeneratePassword(m_Application,length,nonAlphaNumeric);
               m_PasswordTextbox.Text = password;
               m_ConfirmedPasswordTextBox.Text = password;

               m_PasswordTextbox.PasswordChar = '\0';
               m_ConfirmedPasswordTextBox.PasswordChar = '\0';
            }
         }
         else
         {
            m_PasswordTextbox.PasswordChar = '*';
            m_ConfirmedPasswordTextBox.PasswordChar = '*';
         }
      }