Skip to content

Commit 7ff5587

Browse files
committed
feat: added generate random password
1 parent f9138a1 commit 7ff5587

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/joaov1ct0r/restful_api_users_java/modules/users/services/ResetPasswordService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ public void execute(ResetPasswordDTO resetPasswordDTO) throws Exception {
3535
}
3636

3737
var userToUpdate = isUserRegistered.get();
38-
userToUpdate.setPassword("123456");
38+
String newUserPassword = this.generator.generateRandomPassword(9);
39+
userToUpdate.setPassword(newUserPassword);
3940
this.userRepository.save(userToUpdate);
4041
this.emailService.sendMail(
4142
userToUpdate.getEmail(),
4243
"Password Updated",
43-
"Your new password is: " + this.generator.generateRandomPassword(9)
44+
"Your new password is: " + newUserPassword
4445
);
4546
}
4647
}

0 commit comments

Comments
 (0)