Skip to content

Commit

Permalink
use language
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Sep 16, 2018
1 parent a451659 commit ba50b9b
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -268,7 +268,7 @@ private void sendConfirmationLinkEmail(Document doc, UserRegistrationBean userRe
Element adminConfirmationRequiredEl = (Element) rootElement.appendChild(doc.createElementNS(NAMESPACE, "admin-confirmation-required"));
}

MailUtil.send(getFromEmail(), userRegBean.getEmail(), getSubject(), getConfirmationEmailBody(getActivationURL(userRegBean), userRegBean.getLanguage()));
MailUtil.send(getFromEmail(), userRegBean.getEmail(), getSubject(userRegBean.getLanguage()), getConfirmationEmailBody(getActivationURL(userRegBean), userRegBean.getLanguage()));

element.setAttribute("sent-by-yanel", "true");
}
Expand Down Expand Up @@ -308,7 +308,8 @@ private String getFromEmail() throws Exception {
/**
* Get subject of confirmation email
*/
private String getSubject() throws Exception {
private String getSubject(String language) throws Exception {
// TODO: Use language
String subject = "Activate User Registration (sent by Yanel)";
if (getResourceConfigProperty("subject") != null) {
subject = getResourceConfigProperty("subject");
Expand All @@ -328,7 +329,12 @@ private String getConfirmationEmailBody(String url, String language) throws Exce
log.warn("TODO: Use language when provided ...");

if (getResourceConfigProperty("email-body-template-path") != null) {
Node templateNode = getRealm().getRepository().getNode(getResourceConfigProperty("email-body-template-path"));
String templatePath = getResourceConfigProperty("email-body-template-path");
if (language != null && language.length() > 0 && templatePath.indexOf("LANG") >= 0) {
templatePath = templatePath.replace("LANG", language);
}

Node templateNode = getRealm().getRepository().getNode(templatePath);
InputStream in = templateNode.getInputStream();
body = org.apache.commons.io.IOUtils.toString(in);
in.close();
Expand Down

0 comments on commit ba50b9b

Please sign in to comment.