Class UserController

java.lang.Object
app.controller.user.UserController

public class UserController extends Object
The UserController class manages user-related operations such as login and user information updates. It facilitates user authentication and maintains a reference to the currently logged-in user.

Key functionalities include:

  • Authenticating users via login.
  • Updating user information.
  • Retrieving the currently logged-in user.
See Also:
  • Method Details

    • login

      public static boolean login(String username, String password)
      Authenticates a user based on username and password. If authentication is successful, the user is set as the current user.
      Parameters:
      username - The username of the user trying to log in.
      password - The password of the user.
      Returns:
      boolean True if login is successful, false otherwise.
    • update

      public static void update(User oldUser, User newUser)
      Updates an existing user's information with new data provided in another user object.
      Parameters:
      oldUser - The existing user object to be updated.
      newUser - The new user object containing updated information.
    • getCurrentUser

      public static User getCurrentUser()
      Gets the currently logged-in user.
      Returns:
      User The currently logged-in user, or null if no user is logged in.