Skip to content

Commit

Permalink
use the event for email handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Wassim-Rached committed Oct 26, 2024
1 parent d8d3284 commit c16743a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class AccountController {
private final IAccountService accountService;
private final IEmailVerificationTokenService emailVerificationTokenService;
private final IPasswordResetTokenService passwordResetTokenService;
private final IEmailService emailService;
private final ApplicationEventPublisher eventPublisher;

// account management related
Expand All @@ -39,8 +38,8 @@ public ResponseEntity<UUID> createAccount(@RequestBody CreateAccountDTO requestB
// generate email verification token
String token = emailVerificationTokenService.generateEmailVerificationToken(userAccount);

String body = "Click here to verify your email: http://localhost:8080/api/accounts/verify-email?token=" + token;
emailService.sendEmail("wa55death405@gmail.com", "Email verification", body);
var event = new EmailVerificationTokenGeneratedEvent(this, token, userAccount.getEmail());
eventPublisher.publishEvent(event);

return new ResponseEntity<>(userAccount.getId(), HttpStatus.CREATED);
}
Expand Down

0 comments on commit c16743a

Please sign in to comment.