private void confirmPasswordBox_TextChanged(object sender, EventArgs e) { if (FormTools.HasEmptyFields(this)) { allFilledWarningLabel.Visible = true; return; } if (!PasswordIsValid()) { passwordWarningLabel.Text = language == Language.PORTUGUESE ? "A senha precisa ter pelo menos 8 caracteres, uma letra maiúscula, uma minúscula e um número" : "Password needs to have one uppercase, one lowercase letter and a number"; passwordWarningLabel.Visible = true; return; } if (passwordBox.Text == confirmPasswordBox.Text) { // If passwords match, remove password warning label from screen passwordWarningLabel.Visible = false; // If it's all ok, allow sign up if (CanEnableSignUpButton()) { signUpButton.Enabled = true; } } else { passwordWarningLabel.Enabled = false; } }
private bool CanEnableSignUpButton() { if (!FormTools.HasEmptyFields(this)) { if (PasswordIsValid() && PasswordsAreMatch()) { allFilledWarningLabel.Visible = false; passwordWarningLabel.Visible = false; return(true); } } return(false); }
private void textBox_TextChanged(object sender, EventArgs e) { if (!FormTools.HasEmptyFields(this)) { allFilledWarningLabel.Visible = false; if (CanEnableSignUpButton()) { signUpButton.Enabled = true; } return; } allFilledWarningLabel.Visible = true; }