@Override public void actionPerformed(ActionEvent arg0) { BoundaryAuthenticationDialog authenticationDialog = new BoundaryAuthenticationDialog(frame); authenticationDialog.setVisible(true); // Get results from login dialog if (authenticationDialog.isSucceeded()) { // If successfully logged in boolean isTenant = Session.getSessionInstance().isTenant(); boolean isLandLord = Session.getSessionInstance().isLandLord(); if (isLandLord) { // User authenticated as landlord if (!isTenant) { // LandLord, not Tenant if (confirmRegTenantMessage() == JOptionPane.YES_OPTION) { // Register as Tenant LandLord landLord = (LandLord) Session.getSessionInstance().getCustomer(); try { Save.getInstance().deleteUser(landLord.getEmail()); landLord.setTenant(true); Save.getInstance().insertCustomer(landLord); successfulRegistrationMessage(); } catch (ClassNotFoundException | IOException e) { fileReadErrorMessage(); } catch (AlreadyRegisteredException e) { alreadyRegisteredMessage(); } catch (FileException e) { fileReadErrorMessage(); } catch (UserNotFoundException e) { userNotFoundMessage(); } } } else { // LandLord and Tenant // Cannot register errorMessage(); } } else { if (isTenant) { // User authenticated as tenant if (confirmRegLandLordMessage() == JOptionPane.YES_OPTION) { // Register as Tenant BoundaryIbanDialog ibanDialog = new BoundaryIbanDialog(frame); ibanDialog.setVisible(true); } } else { // Administrator or scout or others errorMessage(); } } } }