From 60d2e27e0bd1280e6c71bf8087d207abdd5b3c86 Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Tue, 15 Oct 2024 15:51:22 +0530 Subject: [PATCH 1/2] Change the SMS handler to default. --- .../impl/username/UsernameRecoveryManagerImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java index 5fd5ebcf9a..4f4dcb66f2 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java @@ -171,7 +171,13 @@ public UsernameRecoverDTO notify(String recoveryCode, String channelId, String t // If the notifications are externally managed we do not need to send notifications internally. if (!NotificationChannels.EXTERNAL_CHANNEL.getChannelType().equals(notificationChannel)) { - String eventName = Utils.resolveEventName(notificationChannel); + String eventName; + if (NotificationChannels.SMS_CHANNEL.getChannelType().equals(notificationChannel)){ + eventName = IdentityRecoveryConstants.NOTIFICATION_EVENTNAME_PREFIX + notificationChannel + + IdentityRecoveryConstants.NOTIFICATION_EVENTNAME_SUFFIX; + } else { + eventName = Utils.resolveEventName(notificationChannel); + } validateCallbackURL(properties, userRecoveryData.getUser()); triggerNotification(userRecoveryData.getUser(), notificationChannel, eventName, properties); } From 2536b16b886c0c556d73c47370a9ffafac463aea Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Tue, 15 Oct 2024 15:52:15 +0530 Subject: [PATCH 2/2] Reformat the code. --- .../service/impl/username/UsernameRecoveryManagerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java index 4f4dcb66f2..23d2780213 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/internal/service/impl/username/UsernameRecoveryManagerImpl.java @@ -172,8 +172,8 @@ public UsernameRecoverDTO notify(String recoveryCode, String channelId, String t // If the notifications are externally managed we do not need to send notifications internally. if (!NotificationChannels.EXTERNAL_CHANNEL.getChannelType().equals(notificationChannel)) { String eventName; - if (NotificationChannels.SMS_CHANNEL.getChannelType().equals(notificationChannel)){ - eventName = IdentityRecoveryConstants.NOTIFICATION_EVENTNAME_PREFIX + notificationChannel + if (NotificationChannels.SMS_CHANNEL.getChannelType().equals(notificationChannel)) { + eventName = IdentityRecoveryConstants.NOTIFICATION_EVENTNAME_PREFIX + notificationChannel + IdentityRecoveryConstants.NOTIFICATION_EVENTNAME_SUFFIX; } else { eventName = Utils.resolveEventName(notificationChannel);