Example #1
0
 protected void ProcSenhaValidaOuNao(ForcaSenha forcaSenha, bool valida)
 {
     if (!valida)
     {
         this.lbMsgSenha.Attributes["style"] = "color: red";
         this.lbMsgSenha.Text = forcaSenha.ToString();
     }
     else
     {
         this.lbMsgSenha.Attributes["style"] = "color: green";
         this.lbMsgSenha.Text = forcaSenha.ToString();
     }
 }
        private void textBoxSenha_KeyDown(object sender, KeyEventArgs e)
        {
            ValidacaoSenha validarSenha = new ValidacaoSenha();

            ForcaSenha forca = validarSenha.GetForcaDaSenha(textBoxSenha.Text);

            labelSenha.Text = forca.ToString();

            if (labelSenha.Text == "Inaceitavel" || labelSenha.Text == "Fraca")
            {
                labelSenha.ForeColor = Color.Red;
            }
            else if (labelSenha.Text == "Aceitavel")
            {
                labelSenha.ForeColor = Color.Blue;
            }
            else
            {
                labelSenha.ForeColor = Color.Green;
            }
        }