- java.lang.Object
-
- controllers.UserController
-
- Direct Known Subclasses:
StudentController
,SupervisorController
public class UserController extends java.lang.Object
TheUserController
class 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 likeStudentController
orSupervisorController
orFYPCoordinatorController
.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Scanner
sc
Scanner
object to get input from the user.
-
Constructor Summary
Constructors Constructor Description UserController()
Constructs an instance of theUserController
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
changePassword()
Changes the user's password by prompting for their old and new passwords.
-
-
-
Constructor Detail
-
UserController
public UserController()
Constructs an instance of theUserController
class.
-
-
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
-
-