diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/password/NotificationPasswordRecoveryManager.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/password/NotificationPasswordRecoveryManager.java index 195414b47d..9afc423a52 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/password/NotificationPasswordRecoveryManager.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/password/NotificationPasswordRecoveryManager.java @@ -589,7 +589,6 @@ public void updatePassword(String code, String confirmationCode, String password public User updateUserPassword(String code, String password, Property[] properties) throws IdentityRecoveryException, IdentityEventException { - UserRecoveryDataStore userRecoveryDataStore = JDBCRecoveryDataStore.getInstance(); UserRecoveryData userRecoveryData; try { @@ -884,6 +883,9 @@ private void updateNewPassword(User user, String password, String domainQualifie + "for the user: " + domainQualifiedName, e); } throw Utils.handleServerException(IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_UNEXPECTED, null, e); + } finally { + IdentityUtil.threadLocalProperties.get().remove(AccountConstants.ADMIN_INITIATED); + IdentityUtil.threadLocalProperties.get().remove(AccountConstants.PASSWORD_SET_FLOW); } } @@ -935,6 +937,14 @@ private HashMap getAccountStateClaims(UserRecoveryData userRecov userClaims.put(IdentityRecoveryConstants.ACCOUNT_LOCKED_CLAIM, Boolean.FALSE.toString()); } + // If the recovery scenario is ASK_PASSWORD, it indicates a password set flow. + // Hence, update the thread-local properties to specify that this is a password set flow. + if (RecoveryScenarios.ASK_PASSWORD.equals(recoveryScenario)) { + IdentityUtil.threadLocalProperties.get().put(AccountConstants.PASSWORD_SET_FLOW, true); + } else { + IdentityUtil.threadLocalProperties.get().put(AccountConstants.PASSWORD_SET_FLOW, false); + } + // If the scenario is initiated by the admin, set the account locked claim to FALSE. if (RecoveryScenarios.ADMIN_FORCED_PASSWORD_RESET_VIA_EMAIL_LINK.equals(recoveryScenario) || RecoveryScenarios.ADMIN_FORCED_PASSWORD_RESET_VIA_OTP.equals(recoveryScenario) diff --git a/pom.xml b/pom.xml index 91e7a26617..5f799d1d2e 100644 --- a/pom.xml +++ b/pom.xml @@ -700,7 +700,7 @@ - 1.9.4 + 1.9.5 [1.1.12, 2.0.0)