Class LoginPage
java.lang.Object
boundary.LoginPage
Represents the boundary layer for handling user login, registration, and initial interactions.
This class provides static methods to display the welcome screen, handle login attempts,
facilitate user registration, and allow users to change their passwords.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidHandles the password change process for a user.static voidlogin()Handles the user login process.static voidregister()Handles the user registration process.static voidwelcome()Displays the initial welcome screen and the main menu options (Login, Register, Change Password, Exit).
-
Constructor Details
-
LoginPage
public LoginPage()
-
-
Method Details
-
welcome
public static void welcome()Displays the initial welcome screen and the main menu options (Login, Register, Change Password, Exit). Prompts the user for their choice and directs them to the corresponding functionality. Handles invalid input and loops until a valid choice is made or the user exits. -
login
public static void login()Handles the user login process. Prompts for user ID and password. Calls theAccountController.login(String, String)method to authenticate the user. If successful, initializes relevant controllers based on the user type (Manager, Officer, Applicant) and navigates to the appropriate user page. Catches and displays messages forUserNotFoundExceptionandPasswordIncorrectException. Allows the user to retry login or return to the welcome screen. -
register
public static void register()Handles the user registration process. Prompts the user to select a user type (Applicant, Officer, Manager). Prompts for necessary user details: ID, password, name, age, and marital status. CallsAccountController.register(UserType, String, String, String, int, MaritalStatus)to create the user account. Catches and displays messages forInvalidUserFormatExceptionorAlreadyRegisteredException. Allows the user to retry registration or return to the welcome screen upon failure. Returns to the welcome screen upon successful registration. -
changePassword
public static void changePassword()Handles the password change process for a user. Prompts for the user ID and the current password. Verifies the current password usingAccountController.checkPassword(String, String). If correct, prompts for the new password. CallsAccountController.changePassword(String, String, String)to update the password. Catches and displays messages forUserNotFoundExceptionorPasswordIncorrectException. Allows the user to retry or return to the welcome screen upon failure or completion.
-