- java.lang.Object
-
- controllers.UserController
-
- Direct Known Subclasses:
StudentController,SupervisorController
public class UserController extends java.lang.ObjectTheUserControllerclass is responsible for handling user-related actions, such as changing the user's password. This class serves as a base class for more specific user types likeStudentControllerorSupervisorControllerorFYPCoordinatorController.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.ScannerscScannerobject to get input from the user.
-
Constructor Summary
Constructors Constructor Description UserController()Constructs an instance of theUserControllerclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanchangePassword()Changes the user's password by prompting for their old and new passwords.
-
-
-
Constructor Detail
-
UserController
public UserController()
Constructs an instance of theUserControllerclass.
-
-
Method Detail
-
changePassword
protected boolean changePassword()
Changes the user's password by prompting for their old and new passwords. If the old password matches the current one and the new password is different, the change is successful. The password change fails in the following scenarios:- The old password does not match the current password
- The new password is the same as the old password
- The user decides to quit the process by entering "X"
- Returns:
- true if the password change is successful, false otherwise
-
-