问题
I'm working on an e-mail template that has a "Confirm Registration" button redirects the user to a token related url that will validate the users registration proccess.
Confirm registration button :
<a href="" target="_blank">CONFIRM REGISTRATION</a>
SendVerificationToken method that's creating the confirmationUrl :
public void sendVerificationToken(User user) {
String token = jwtTokenService.genEmailVerificationToken(user.getId());
logger.info("Sending verification token to user. user={} email={} token={}",
user.getId(), user.getEmail(), token);
String confirmationUrl = null;
try {
confirmationUrl = new URIBuilder(verifyEmailUrl)
.addParameter(VERIFY_EMAIL_ENDPOINT_PARAM, token)
.build().toString();
}
catch (URISyntaxException e) {
logger.error("URL stored as redirect url for verify email is not valid.");
throw ErrorFactory.serverError("Error");
}
emailService.sendAccountConfirmationEmail(user.getEmail(), confirmationUrl);
}
I wanna know how do I pass the confirmationUrl parameter from the sendVerificationToken method to the "Confirm Registration" button. Would appreciate if someone could help me with this one. Thank you.
来源:https://stackoverflow.com/questions/65293021/how-to-pass-url-parameter-from-service-layer-to-thymeleaf-template