java.lang.Object
com.example.cab302project.LoginController
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonLogin()Handles the login button action.voidHandles the register button action.voidAction handler for the Login tab button.voidAction handler for the Sign Up tab button.
-
Constructor Details
-
LoginController
public LoginController()Initializes a new LoginController. Connects to the global database instance defined inHelloApplication.
-
-
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'sUser.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.
-