diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EmailMessageProperties.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EmailMessageProperties.java index 2418e0247a..7bac7098cc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EmailMessageProperties.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EmailMessageProperties.java @@ -31,6 +31,7 @@ public class EmailMessageProperties { private String title; private String password; private String userName; + private String domainName; public String getUserName() { return userName; @@ -40,6 +41,14 @@ public class EmailMessageProperties { this.userName = userName; } + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + public String getMessageBody() { return messageBody; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/EmailConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/EmailConstants.java index 2fac091319..270501a032 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/EmailConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/EmailConstants.java @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.email; public final class EmailConstants { public static final class EnrolmentEmailConstants { + public static final String DOMAIN = "domain"; public static final String USERNAME = "user-name"; public static final String DOWNLOAD_URL = "downloadUrl"; public static final String ENCODED_SCHEME = "UTF-8"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 5e211a4884..04611b2757 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -588,7 +588,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv break; } } - +log.error("======================================================================"); + log.error(messageBody); +log.error("======================================================================"); StringBuilder messageBuilder = new StringBuilder(); try { @@ -609,6 +611,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv + "\\}", URLEncoder.encode(emailMessageProperties.getUserName(), EmailConstants.EnrolmentEmailConstants .ENCODED_SCHEME)); + messageBody = messageBody.trim().replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.DOMAIN + + "\\}", + URLEncoder.encode(emailMessageProperties.getDomainName(), EmailConstants.EnrolmentEmailConstants + .ENCODED_SCHEME)); messageBody = messageBody.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.PASSWORD + "\\}", URLEncoder.encode(emailMessageProperties.getPassword(), EmailConstants.EnrolmentEmailConstants @@ -624,6 +630,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv messageFooter1.trim()); messageBuilder.append(System.getProperty("line.separator")).append(messageFooter2.trim()); messageBuilder.append(System.getProperty("line.separator")).append(messageFooter3.trim()); + log.info(messageBuilder.toString()); } catch (IOException e) { throw new DeviceManagementException("Error replacing tags in email template '" + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/notification-messages.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/notification-messages.xml index 9b13c5d808..9ee0a48004 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/notification-messages.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/notification-messages.xml @@ -21,6 +21,7 @@
Dear {first-name},
You have been registered to WSO2 MDM with following credentials. +Domain: {domain} Username: {user-name} Password: {password} Below is the link to enroll.