Merge pull request 'Update invite link' (#152) from rajitha/device-mgt-core:update-invitation-mail-invite-link into master

Reviewed-on: community/device-mgt-core#152
footerconfig
commit 22000de5a8

@ -237,9 +237,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
} }
} }
} }
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
OneTimePinDTO oneTimePinDTO;
List<OneTimePinDTO> oneTimePinDTOList = new ArrayList<>();
Properties props = new Properties(); Properties props = new Properties();
props.setProperty("enrollment-steps", enrollmentSteps.toString()); props.setProperty("enrollment-steps", enrollmentSteps.toString());
try { try {
@ -247,22 +244,11 @@ public class OTPManagementServiceImpl implements OTPManagementService {
for (String username : deviceEnrollmentInvitation.getUsernames()) { for (String username : deviceEnrollmentInvitation.getUsernames()) {
String emailAddress = DeviceManagerUtil.getUserClaimValue( String emailAddress = DeviceManagerUtil.getUserClaimValue(
username, DeviceManagementConstants.User.CLAIM_EMAIL_ADDRESS); username, DeviceManagementConstants.User.CLAIM_EMAIL_ADDRESS);
OneTimePinDTO oneTimePinData = new OneTimePinDTO();
oneTimePinData.setEmail(emailAddress);
oneTimePinData.setTenantId(tenantId);
oneTimePinData.setUsername(username);
oneTimePinData.setEmailType(OTPEmailTypes.USER_INVITE.toString());
oneTimePinDTO = generateOneTimePin(oneTimePinData, false);
oneTimePinDTOList.add(oneTimePinDTO);
props.setProperty("first-name", DeviceManagerUtil. props.setProperty("first-name", DeviceManagerUtil.
getUserClaimValue(username, DeviceManagementConstants.User.CLAIM_FIRST_NAME)); getUserClaimValue(username, DeviceManagementConstants.User.CLAIM_FIRST_NAME));
props.setProperty("username", username); props.setProperty("username", username);
props.setProperty("otp-token", oneTimePinDTO.getOtpToken());
sendMail(props, emailAddress, DeviceManagementConstants.EmailAttributes.USER_ENROLLMENT_TEMPLATE); sendMail(props, emailAddress, DeviceManagementConstants.EmailAttributes.USER_ENROLLMENT_TEMPLATE);
} }
this.otpManagementDAO.addOTPData(oneTimePinDTOList);
ConnectionManagerUtil.commitDBTransaction(); ConnectionManagerUtil.commitDBTransaction();
} catch (UserStoreException e) { } catch (UserStoreException e) {
String msg = "Error occurred while getting claim values to invite user"; String msg = "Error occurred while getting claim values to invite user";
@ -276,11 +262,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
String msg = "SQL Error occurred when adding OPT data to send device enrollment Invitation."; String msg = "SQL Error occurred when adding OPT data to send device enrollment Invitation.";
log.error(msg, e); log.error(msg, e);
throw new OTPManagementException(msg, e); throw new OTPManagementException(msg, e);
} catch (OTPManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while saving the OTP data.";
log.error(msg, e);
throw new OTPManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }

@ -37,7 +37,7 @@
</p> </p>
<p style="font-size: 1em; font-family: Arial, Helvetica; line-height: 170%; color: #666666; margin: 5px 0px;"> <p style="font-size: 1em; font-family: Arial, Helvetica; line-height: 170%; color: #666666; margin: 5px 0px;">
You have been invited to enrol your device in Entgra IoT Server. You have been invited to enrol your device in Entgra IoT Server.
Click <a href="$base-url-https/self-register/devices/enroll?token=$otp-token">here</a> to begin device enrolment.</p> Click <a href="$base-url-https/endpoint-mgt/devices/enroll">here</a> to begin device enrolment.</p>
<p style="font-length: 1em; font-family: Arial, Helvetica; line-height: 170%; color: #666666; margin: 5px 0px;"> <p style="font-length: 1em; font-family: Arial, Helvetica; line-height: 170%; color: #666666; margin: 5px 0px;">
Enrollment Steps are as below, Enrollment Steps are as below,

Loading…
Cancel
Save