diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java index 3988917cf5..1cbb5a138b 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java @@ -58,7 +58,11 @@ public Response recoverPasswordPost(RecoveryInitiatingRequestDTO recoveryInitiat equals(resolvedUserResult.getResolvedStatus())) { User resolvedUser = new User(); resolvedUser.setUserName(resolvedUserResult.getUser().getUsername()); - resolvedUser.setUserStoreDomain(resolvedUserResult.getUser().getUserStoreDomain()); + if (StringUtils.isBlank(user.getRealm())) { + resolvedUser.setUserStoreDomain(resolvedUserResult.getUser().getUserStoreDomain()); + } else { + resolvedUser.setUserStoreDomain(user.getRealm()); + } resolvedUser.setTenantDomain(resolvedUserResult.getUser().getTenantDomain()); notificationResponseBean = notificationPasswordRecoveryManager.sendRecoveryNotification(resolvedUser, type, notify,