Class LoginController

java.lang.Object
com.example.cab302project.LoginController

public class LoginController extends Object
Controller class for the Login screen (login-view.fxml). Handles user authentication by interfacing with the IAppDAO and manages navigation between the login, registration, and dashboard screens.
  • Constructor Details

    • LoginController

      public LoginController()
      Initializes a new LoginController. Connects to the global database instance defined in HelloApplication.
  • Method Details

    • onLogin

      public void onLogin()
      Handles the login button action. Validates that input fields are not empty, verifies credentials via the DAO, and switches to the appropriate dashboard based on the user's User.isPolice() status.

      If authentication is successful, the user details are stored in UserSession.

    • onRegister

      public void onRegister()
      Handles the register button action. Navigates the user to the registration screen.
    • onTabLogin

      public void onTabLogin()
      Action handler for the Login tab button. Currently a no-op as the user is already on the login screen.
    • onTabSignup

      public void onTabSignup()
      Action handler for the Sign Up tab button. Redirects the user to the registration screen.