Advertisement
Guest User

Untitled

a guest
May 16th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.02 KB | None | 0 0
  1.     private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {                                        
  2.                
  3.         String email = txtEmail.getText();
  4.         String password = txtPassword.getText();
  5.        
  6.         if(email.equals("") || password.equals(""))
  7.         {
  8.            JOptionPane.showMessageDialog(null, "Please enter information in both fields.", "Missing Info", JOptionPane.WARNING_MESSAGE);
  9.         }
  10.        
  11.         else
  12.         {    
  13.             if (rbnStaff.isSelected())
  14.             {
  15.                 if(staff.containsKey(email))
  16.                 {
  17.                     if(staff.get(email).doesPasswordEqual(password))
  18.                     {
  19.                         txtEmail.setText("");
  20.                         txtPassword.setText("");
  21.                         new StaffMenu().setVisible(true);
  22.                         this.dispose();
  23.                     }
  24.                
  25.                     else
  26.                     {
  27.                        JOptionPane.showMessageDialog(null, "Incorrect Password", "Login Error", JOptionPane.ERROR_MESSAGE);
  28.                     }
  29.                 }
  30.             }
  31.             else if (rbnCust.isSelected())
  32.             {
  33.                 if(cust.containsKey(email))
  34.                 {
  35.                     if(cust.get(email).doesPasswordEqual(password))
  36.                     {
  37.                         txtEmail.setText("");
  38.                         txtPassword.setText("");
  39.                         new Menu().setVisible(true);
  40.                         this.dispose();
  41.                     }
  42.                
  43.                     else
  44.                     {
  45.                        JOptionPane.showMessageDialog(null, "Incorrect Password", "Login Error", JOptionPane.ERROR_MESSAGE);
  46.                     }
  47.                 }
  48.             }    
  49.         else
  50.         {
  51.             JOptionPane.showMessageDialog(null, "User does not exist in database.", "Login Error", JOptionPane.ERROR_MESSAGE);
  52.         }
  53.                
  54.         }    
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement