Class UserRegister
java.lang.Object
application.user.UserRegister
The UserRegister class is responsible for handling the user registration process.
It ensures that the provided user details meet the necessary criteria and that
the username and email are not already in use. It also hashes the user's password
before saving the user information into the repository.
-
Constructor Summary
ConstructorsConstructorDescriptionUserRegister(PasswordHasher hasher, UserRepository repo) Constructs aUserRegisterinstance responsible for handling the user registration process. -
Method Summary
-
Constructor Details
-
UserRegister
Constructs aUserRegisterinstance responsible for handling the user registration process. It ensures user details meet validation criteria, such as uniqueness of username and email, and hashes passwords before saving user information into the repository.- Parameters:
hasher- aPasswordHasherimplementation used to hash user passwords.repo- aUserRepositoryimplementation responsible for storing user data.
-
-
Method Details
-
execute
Executes a user registration. Validation checks, checks if username or e-mail already exists. Hashes inputted password using PasswordHasher, that uses SHA256PasswordHasher. Creates user object, and inserts it into UserRepository using insert method.- Parameters:
username-phoneNumber-password-email-
-