Package app.controller.user
Class UserController
java.lang.Object
app.controller.user.UserController
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 Summary
Modifier and TypeMethodDescriptionstatic UserGets the currently logged-in user.static booleanAuthenticates a user based on username and password.static voidUpdates an existing user's information with new data provided in another user object.
-
Method Details
-
login
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
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
Gets the currently logged-in user.- Returns:
- User The currently logged-in user, or null if no user is logged in.
-