Enable Domain name in the invitation main

4.x.x
Kamidu Sachith 9 years ago
parent cd33b2bb4e
commit 8573a284e0

@ -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;
}

@ -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";

@ -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 '" +

@ -21,6 +21,7 @@
<Header>Dear {first-name},</Header>
<Body>
You have been registered to WSO2 MDM with following credentials.
Domain: {domain}
Username: {user-name}
Password: {password}
Below is the link to enroll.

Loading…
Cancel
Save