Allow to configure the path of the email templates (ref #7122)
This commit is contained in:
parent
ae0618d5be
commit
2c29469590
|
@ -61,7 +61,7 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createContent(UUID confirmationToken, MailService mailService) {
|
private String createContent(UUID confirmationToken, MailService mailService) {
|
||||||
String content = mailService.getMailTemplateContent("classpath:templates/email/emailConfirmation.html");
|
String content = mailService.getMailTemplateContent(this.environment.getProperty("email.confirmation"));
|
||||||
content = content.replace("{confirmationToken}", confirmationToken.toString());
|
content = content.replace("{confirmationToken}", confirmationToken.toString());
|
||||||
content = content.replace("{expiration_time}", secondsToTime(Integer.parseInt(this.environment.getProperty("conf_email.expiration_time_seconds"))));
|
content = content.replace("{expiration_time}", secondsToTime(Integer.parseInt(this.environment.getProperty("conf_email.expiration_time_seconds"))));
|
||||||
content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
|
content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
|
||||||
|
@ -85,7 +85,7 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createMergeContent(UUID confirmationToken, MailService mailService, String userName) {
|
private String createMergeContent(UUID confirmationToken, MailService mailService, String userName) {
|
||||||
String content = mailService.getMailTemplateContent("classpath:templates/email/emailMergeConfirmation.html");
|
String content = mailService.getMailTemplateContent(this.environment.getProperty("email.merge"));
|
||||||
content = content.replace("{userName}", userName);
|
content = content.replace("{userName}", userName);
|
||||||
content = content.replace("{confirmationToken}", confirmationToken.toString());
|
content = content.replace("{confirmationToken}", confirmationToken.toString());
|
||||||
content = content.replace("{expiration_time}", secondsToTime(Integer.parseInt(this.environment.getProperty("conf_email.expiration_time_seconds"))));
|
content = content.replace("{expiration_time}", secondsToTime(Integer.parseInt(this.environment.getProperty("conf_email.expiration_time_seconds"))));
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class InvitationServiceImpl implements InvitationService {
|
||||||
return CompletableFuture.runAsync(() -> {
|
return CompletableFuture.runAsync(() -> {
|
||||||
SimpleMail mail = new SimpleMail();
|
SimpleMail mail = new SimpleMail();
|
||||||
mail.setSubject(createSubject(dmp, mailService.getMailTemplateSubject()));
|
mail.setSubject(createSubject(dmp, mailService.getMailTemplateSubject()));
|
||||||
mail.setContent(createContent(invitation.getId(), dmp, recipient, mailService.getMailTemplateContent("classpath:templates/email/email.html"), role));
|
mail.setContent(createContent(invitation.getId(), dmp, recipient, mailService.getMailTemplateContent(this.environment.getProperty("email.invite")), role));
|
||||||
mail.setTo(invitation.getInvitationEmail());
|
mail.setTo(invitation.getInvitationEmail());
|
||||||
try {
|
try {
|
||||||
mailService.sendSimpleMail(mail);
|
mailService.sendSimpleMail(mail);
|
||||||
|
|
|
@ -27,6 +27,11 @@ configuration.rda=RDACommonStandards.txt
|
||||||
configuration.h2020template=documents/h2020.docx
|
configuration.h2020template=documents/h2020.docx
|
||||||
configuration.configurable_login_providers=configurableLoginProviders.json
|
configuration.configurable_login_providers=configurableLoginProviders.json
|
||||||
|
|
||||||
|
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
|
||||||
|
email.invite=classpath:templates/email/email.html
|
||||||
|
email.confirmation=classpath:templates/email/emailConfirmation.html
|
||||||
|
email.merge=classpath:templates/email/emailMergeConfirmation.html
|
||||||
|
|
||||||
#############FACEBOOK LOGIN CONFIGURATIONS#########
|
#############FACEBOOK LOGIN CONFIGURATIONS#########
|
||||||
facebook.login.clientId=
|
facebook.login.clientId=
|
||||||
facebook.login.clientSecret=
|
facebook.login.clientSecret=
|
||||||
|
|
|
@ -39,6 +39,11 @@ configuration.rda=RDACommonStandards.txt
|
||||||
configuration.h2020template=documents/h2020.docx
|
configuration.h2020template=documents/h2020.docx
|
||||||
configuration.configurable_login_providers=ConfigurableLoginProviders.json
|
configuration.configurable_login_providers=ConfigurableLoginProviders.json
|
||||||
|
|
||||||
|
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
|
||||||
|
email.invite=file:templates/email/email.html
|
||||||
|
email.confirmation=file:templates/email/emailConfirmation.html
|
||||||
|
email.merge=file:templates/email/emailMergeConfirmation.html
|
||||||
|
|
||||||
#############LOGIN CONFIGURATIONS#########
|
#############LOGIN CONFIGURATIONS#########
|
||||||
#############GENERIC LOGIN CONFIGURATIONS#########
|
#############GENERIC LOGIN CONFIGURATIONS#########
|
||||||
autouser.root.email=
|
autouser.root.email=
|
||||||
|
|
Loading…
Reference in New Issue