From bdf2e2c976ab8b637be15c5aceb6ce9d1973b9a2 Mon Sep 17 00:00:00 2001 From: somindatommy Date: Thu, 9 Jan 2020 12:02:41 +0530 Subject: [PATCH] new account recovery api: addressing changes --- .../identity/recovery/IdentityRecoveryConstants.java | 10 +++++----- .../confirmation/ResendConfirmationManager.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/IdentityRecoveryConstants.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/IdentityRecoveryConstants.java index 83e571d8d0..e2bb0b5d91 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/IdentityRecoveryConstants.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/IdentityRecoveryConstants.java @@ -254,13 +254,13 @@ public enum ErrorMessages { ERROR_CODE_PASSWORD_RECOVERY_WITH_NOTIFICATIONS_NOT_ENABLED( "PWR-10002", "Password recovery with notifications is not enabled"), ERROR_CODE_NO_PASSWORD_IN_REQUEST("PWR-10003", "No password found"), - ERROR_CODE_PASSWORD_RECOVERY_NOT_ENABLED("UNR-10004", "Password recovery is not enabled"), - ERROR_CODE_PASSWORD_HISTORY_VIOLATION("UNR-10005", "This password has been used in recent " + ERROR_CODE_PASSWORD_RECOVERY_NOT_ENABLED("PWR-10004", "Password recovery is not enabled"), + ERROR_CODE_PASSWORD_HISTORY_VIOLATION("PWR-10005", "This password has been used in recent " + "history. Please choose a different password"), - ERROR_CODE_PASSWORD_POLICY_VIOLATION("UNR-10006", "Password policy violation"), - ERROR_CODE_INVALID_CALLBACK_PASSWORD_RESET("UNR-10007", "Invalid callback url in password " + + ERROR_CODE_PASSWORD_POLICY_VIOLATION("PWR-10006", "Password policy violation"), + ERROR_CODE_INVALID_CALLBACK_PASSWORD_RESET("PWR-10007", "Invalid callback url in password " + "reset request"), - ERROR_CODE_PASSWORD_RECOVERY_EMPTY_TENANT_DOMAIN("UNR-10008", "Empty tenant domain in password " + ERROR_CODE_PASSWORD_RECOVERY_EMPTY_TENANT_DOMAIN("PWR-10008", "Empty tenant domain in password " + "recovery request"), ERROR_CODE_UNEXPECTED_ERROR_PASSWORD_RESET("PWR-15001", "Unexpected error during " + "password reset"); diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/confirmation/ResendConfirmationManager.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/confirmation/ResendConfirmationManager.java index 336b88c239..5b368af811 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/confirmation/ResendConfirmationManager.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/confirmation/ResendConfirmationManager.java @@ -141,7 +141,7 @@ public ResendConfirmationDTO resendConfirmation(String tenantDomain, String rese UserRecoveryData userRecoveryData = userAccountRecoveryManager .getUserRecoveryData(resendCode, RecoverySteps.RESEND_CONFIRMATION_CODE); User user = userRecoveryData.getUser(); - if (!StringUtils.equals(tenantDomain,user.getTenantDomain())) { + if (!StringUtils.equals(tenantDomain, user.getTenantDomain())) { throw Utils.handleClientException( IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_USER_TENANT_DOMAIN_MISS_MATCH_WITH_CONTEXT, tenantDomain); @@ -151,7 +151,7 @@ public ResendConfirmationDTO resendConfirmation(String tenantDomain, String rese resendCode); } // Validate the tenant domain and the recovery scenario in the request. - validateRequestAttributes(user,scenario,userRecoveryData.getRecoveryScenario(),tenantDomain,resendCode); + validateRequestAttributes(user, scenario, userRecoveryData.getRecoveryScenario(), tenantDomain, resendCode); validateCallback(properties, user.getTenantDomain()); UserRecoveryDataStore userRecoveryDataStore = JDBCRecoveryDataStore.getInstance(); userRecoveryDataStore.invalidate(user); @@ -195,7 +195,7 @@ private void validateRequestAttributes(User recoveredUser, RecoveryScenarios sce String tenantDomainInRequest, String resendCode) throws IdentityRecoveryClientException { - if (!StringUtils.equals(tenantDomainInRequest,recoveredUser.getTenantDomain())) { + if (!StringUtils.equals(tenantDomainInRequest, recoveredUser.getTenantDomain())) { throw Utils.handleClientException( IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_USER_TENANT_DOMAIN_MISS_MATCH_WITH_CONTEXT, tenantDomainInRequest);