diff --git a/src/resources/registration/src/java/org/wyona/yanel/resources/registration/UserRegistrationResource.java b/src/resources/registration/src/java/org/wyona/yanel/resources/registration/UserRegistrationResource.java index b6ab12a4d..e9e07a4f3 100644 --- a/src/resources/registration/src/java/org/wyona/yanel/resources/registration/UserRegistrationResource.java +++ b/src/resources/registration/src/java/org/wyona/yanel/resources/registration/UserRegistrationResource.java @@ -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"); } @@ -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"); @@ -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();