From d5270c720c394df20484b0f2b8936ffc49453d95 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 ebf75b841ed..d8872be9212 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
@@ -237,9 +237,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 {
@@ -247,22 +244,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";
@@ -276,11 +262,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 7765bcdda2e..ef5307de332 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,