From 729f1fd85fbbdeef584ea667f8c1aceef2bfaa85 Mon Sep 17 00:00:00 2001
From: rajitha
Date: Tue, 27 Jun 2023 13:26:05 +0530
Subject: [PATCH] Update invite link
---
.../mgt/service/OTPManagementServiceImpl.java | 19 -------------------
.../email/templates/user-enrollment.vm | 2 +-
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
index ee087d3c68..074eb8eed7 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
@@ -227,9 +227,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
}
}
}
- int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
- OneTimePinDTO oneTimePinDTO;
- List oneTimePinDTOList = new ArrayList<>();
Properties props = new Properties();
props.setProperty("enrollment-steps", enrollmentSteps.toString());
try {
@@ -237,22 +234,11 @@ public class OTPManagementServiceImpl implements OTPManagementService {
for (String username : deviceEnrollmentInvitation.getUsernames()) {
String emailAddress = DeviceManagerUtil.getUserClaimValue(
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.
getUserClaimValue(username, DeviceManagementConstants.User.CLAIM_FIRST_NAME));
props.setProperty("username", username);
- props.setProperty("otp-token", oneTimePinDTO.getOtpToken());
sendMail(props, emailAddress, DeviceManagementConstants.EmailAttributes.USER_ENROLLMENT_TEMPLATE);
}
- this.otpManagementDAO.addOTPData(oneTimePinDTOList);
ConnectionManagerUtil.commitDBTransaction();
} catch (UserStoreException e) {
String msg = "Error occurred while getting claim values to invite user";
@@ -266,11 +252,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
String msg = "SQL Error occurred when adding OPT data to send device enrollment Invitation.";
log.error(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 {
ConnectionManagerUtil.closeDBConnection();
}
diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
index 7765bcdda2..ef5307de33 100644
--- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
+++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
@@ -37,7 +37,7 @@
You have been invited to enrol your device in Entgra IoT Server.
- Click here to begin device enrolment.
+ Click here to begin device enrolment.
Enrollment Steps are as below,