예제 #1
0
 public void IniciarSesion()
 {
     if (trans.ComprobarAccesoInternet())
     {
         Cliente cliente = new Cliente()
         {
             IdCliente   = txtEmail.Text.ToString(),
             Contrasenia = txtPassword.Text.ToString()
         };
         states = cliente.AuthenticateUser("RW_Security_authenticate_User");
         if (states[0])
         {
             if (states[1])
             {
                 if (ct.ComprobarExistenciaTablas(paths.PathUser))
                 {
                     File.Delete(paths.PathUser);
                     using (StreamWriter user = new StreamWriter(paths.PathUser, false))
                         user.WriteLine(txtEmail.Text.ToString().ToLower());
                     Application.Restart();
                 }
                 else
                 {
                     using (StreamWriter user = new StreamWriter(paths.PathUser, false))
                         user.WriteLine(txtEmail.Text.ToString().ToLower());
                     Application.Restart();
                 }
             }
             else
             {
                 MessageBox.Show("Tu cuenta no esta activada, por favor revisa tu correo. ", "Falla de activación", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("El usuario o contraseña es incorrecto. ", "Falla de autenticación", MessageBoxButtons.OK, MessageBoxIcon.Error);
             intentos++;
             if (intentos >= 3)
             {
                 this.Size                = new Size(526, 324);
                 tlpCaptcha.Visible       = true;
                 btnIniciarSesion.Enabled = false;
                 numeroTemporal           = captcha.CargarCaptcha(picCaptcha).ToString();
                 captchaStateLocked       = true;
                 txtCaptcha.Focus();
             }
         }
     }
     else
     {
         MessageBox.Show("No cuentas con acceso a internet, vuelve a intentarlo más tarde.", "Falla de red", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }