Class LoginPage

java.lang.Object
boundary.LoginPage

public class LoginPage extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Handles the password change process for a user.
    static void
    Handles the user login process.
    static void
    Handles the user registration process.
    static void
    Displays the initial welcome screen and the main menu options (Login, Register, Change Password, Exit).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the AccountController.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 for UserNotFoundException and PasswordIncorrectException. 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. Calls AccountController.register(UserType, String, String, String, int, MaritalStatus) to create the user account. Catches and displays messages for InvalidUserFormatException or AlreadyRegisteredException. 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 using AccountController.checkPassword(String, String). If correct, prompts for the new password. Calls AccountController.changePassword(String, String, String) to update the password. Catches and displays messages for UserNotFoundException or PasswordIncorrectException. Allows the user to retry or return to the welcome screen upon failure or completion.