Exemple #1
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     if (textBoxPassword.Text == "" && textBoxUsername.Text == "")
     {
         MessageBox.Show("fields cannot be empty");
     }
     else
     {
         email    = textBoxUsername.Text;
         password = textBoxPassword.Text;
         if (LoginController.loginControl(email, password))
         {
             userId = LoginController.getUserIdByMail(email);
             role   = LoginController.getRoleByUserId(userId);
             if (LoginController.checkFirstLogin(email, password))
             {
                 MessageBox.Show("First Login");
                 MessageBox.Show("Redirecting to password change");
                 Hide();
                 using (var cp = new PasswordChange(password, userId))
                     cp.ShowDialog();
                 cleartextBox();
                 Show();
             }
             else
             {
                 Hide();
                 using (var mf = new mainForm(role, userId, this))
                     mf.ShowDialog();
                 cleartextBox();
                 Show();
             }
         }
         else
         {
             MessageBox.Show("Access failed");
         }
     }
 }
 private void buttonChangePassword_Click(object sender, EventArgs e)
 {
     using (var cp = new PasswordChange(LoginController.getPassByUserId(userId), userId))
         cp.ShowDialog();
 }