Package main.boundary.account
Class ChangeAccountPassword
java.lang.Object
main.boundary.account.ChangeAccountPassword
This class is responsible for handling the change password feature for a given user account. It contains
two methods,
changePassword and askToRetry, that are used for this purpose.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaskToRetry(UserType userType, String userID) This method is called when the user enters an incorrect password and wants to retry the password change.static voidchangePassword(UserType userType, String userID) This method is called to change the password for a given user account.
-
Constructor Details
-
ChangeAccountPassword
public ChangeAccountPassword()
-
-
Method Details
-
askToRetry
This method is called when the user enters an incorrect password and wants to retry the password change. It prompts the user to either go back or try again, and throws aPageBackExceptionif the user chooses to go back.- Parameters:
userType- the type of user who wants to change their passworduserID- the ID of the user who wants to change their password- Throws:
PageBackException- if the user chooses to go back
-
changePassword
This method is called to change the password for a given user account. It prompts the user for their old password and verifies it, then prompts the user for their new password and verifies that it is entered correctly. If successful, it updates the user's password and displays a success message before throwing aPageBackExceptionto return to the previous page.- Parameters:
userType- the type of user who wants to change their passworduserID- the ID of the user who wants to change their password- Throws:
PageBackException- if the user chooses to go back
-