private void BttnLogIn_Click(object sender, EventArgs e)
 {
     if (txtUser.Text != "")
     {
         if (txtPassword.Text != "")
         {
             if ((userCollection.Search(txtUser.Text).UserName == txtUser.Text && userCollection.Search(txtUser.Text).Password == txtPassword.Text) || (txtUser.Text == "admin" && txtPassword.Text == "1234"))
             {
                 lblIncorrect.Visible = false;
                 userCollection.Search(txtUser.Text).LastAcess = DateTime.Now;
                 xmlUsers.GenerateXMLUsers(userCollection.GetAll());
                 FormMenu formMenu = new FormMenu(userCollection.Search(txtUser.Text));
                 formMenu.Show();
                 Hide();
             }
             else
             {
                 lblIncorrect.Visible = true;
             }
         }
         else
         {
             MessageBox.Show("No se ha ingresado ninguna contraseña.");
         }
     }
     else
     {
         MessageBox.Show("No se ha ingresado ningún nombre de usuario.");
     }
 }
Exemple #2
0
 private void BttnRecuperate_Click(object sender, EventArgs e)
 {
     if (userCollection.Search(cmbRecUser.SelectedItem.ToString()).Question == cmbRecQuestion.SelectedItem.ToString())
     {
         if (userCollection.Search(cmbRecUser.SelectedItem.ToString()).Answer == txtRecAnswer.Text)
         {
             if (txtRecPassword.Text != "")
             {
                 userCollection.Search(cmbRecUser.SelectedItem.ToString()).Password = txtRecPassword.Text;
                 xmlUsers.GenerateXMLUsers(userCollection.GetAll());
                 MessageBox.Show("Contraseña restaurada correctamente. La nueva contraseña es: " + txtRecPassword.Text);
             }
             else
             {
                 MessageBox.Show("No puedes crear un usuario sin contraseña.");
             }
         }
         else
         {
             MessageBox.Show("Datos ingresados incorrectos.");
         }
     }
     else
     {
         MessageBox.Show("Datos ingresados incorrectos.");
     }
 }