Class LoginController

java.lang.Object
com.ehealthsystem.login.LoginController

public class LoginController extends Object
  • Field Details

    • emailTextField

      public javafx.scene.control.TextField emailTextField
    • passwordField

      public javafx.scene.control.PasswordField passwordField
    • loginButton

      public javafx.scene.control.Button loginButton
    • registrationLabel

      public javafx.scene.control.Label registrationLabel
    • errorLabel

      public javafx.scene.control.Label errorLabel
  • Constructor Details

    • LoginController

      public LoginController()
  • Method Details

    • handleLoginButton

      public void handleLoginButton(javafx.event.ActionEvent event) throws IOException, SQLException
      Method called when Login Button is pressed. Used to validate the filled in information.
      Parameters:
      event - event that triggered the login button
      Throws:
      IOException
      SQLException
    • validateAdmin

      private boolean validateAdmin()
      Check if the user that is currently logging in is the system's administrator
      Returns:
      whether the admin is logging in
    • validateUsernameOrEmail

      private boolean validateUsernameOrEmail()
      Method to validate the email format.
      Returns:
      true if email format filled in matches pattern
    • validatePasswordField

      private boolean validatePasswordField()
      Method to validate the Password typed in.
      Returns:
      true if the password field is filled
    • loadPrimaryWindow

      private void loadPrimaryWindow(javafx.event.Event event) throws IOException, SQLException
      Method called to switch scene to primary window after successfully logged in.
      Throws:
      IOException - FXMLLoader can't find file for switching scene
      SQLException
    • loadAdminWindow

      private void loadAdminWindow(javafx.event.ActionEvent event) throws SQLException, IOException
      Throws:
      SQLException
      IOException
    • validateCredentials

      public boolean validateCredentials() throws SQLException
      Method to validate the email and password matches with the email and password in the database
      Returns:
      true if credentials match the credentials in the database
      Throws:
      SQLException
    • handleRegistrationLabel

      public void handleRegistrationLabel(javafx.scene.input.MouseEvent event) throws IOException
      Method called to switch scene to registration form.
      Parameters:
      event - MouseEvent that triggered the method
      Throws:
      IOException - if the FXMLLoader can't find the scene