Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {
- String email = txtEmail.getText();
- String password = txtPassword.getText();
- if(email.equals("") || password.equals(""))
- {
- JOptionPane.showMessageDialog(null, "Please enter information in both fields.", "Missing Info", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- if (rbnStaff.isSelected())
- {
- if(staff.containsKey(email))
- {
- if(staff.get(email).doesPasswordEqual(password))
- {
- txtEmail.setText("");
- txtPassword.setText("");
- new StaffMenu().setVisible(true);
- this.dispose();
- }
- else
- {
- JOptionPane.showMessageDialog(null, "Incorrect Password", "Login Error", JOptionPane.ERROR_MESSAGE);
- }
- }
- }
- else if (rbnCust.isSelected())
- {
- if(cust.containsKey(email))
- {
- if(cust.get(email).doesPasswordEqual(password))
- {
- txtEmail.setText("");
- txtPassword.setText("");
- new Menu().setVisible(true);
- this.dispose();
- }
- else
- {
- JOptionPane.showMessageDialog(null, "Incorrect Password", "Login Error", JOptionPane.ERROR_MESSAGE);
- }
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null, "User does not exist in database.", "Login Error", JOptionPane.ERROR_MESSAGE);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement