From 969c336077905696803e7c6b01eac9bd696dce41 Mon Sep 17 00:00:00 2001 From: rushannanayakkara Date: Wed, 7 Feb 2024 15:49:06 +0530 Subject: [PATCH] Fix idp domain being dropped when checking for existing user. --- .../recovery/signup/UserSelfRegistrationManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java index ea3e1d4987..f6e0d20d5e 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java @@ -1287,13 +1287,13 @@ public boolean isUsernameAlreadyTaken(String username, String tenantDomain) thro if (StringUtils.isBlank(tenantDomain)) { tenantDomain = MultitenantUtils.getTenantDomain(username); + // If tenant domain is not provided, tenant domain is derived from the username. + username = MultitenantUtils.getTenantAwareUsername(username); } try { - String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username); - UserRealm userRealm = getUserRealm(tenantDomain); if (userRealm != null) { - isUsernameAlreadyTaken = userRealm.getUserStoreManager().isExistingUser(tenantAwareUsername) || + isUsernameAlreadyTaken = userRealm.getUserStoreManager().isExistingUser(username) || hasPendingAddUserWorkflow(username, tenantDomain); } } catch (CarbonException | org.wso2.carbon.user.core.UserStoreException e) {