From 5a3db6c7a64a96f73c717385556bc3612c03c47a Mon Sep 17 00:00:00 2001 From: Loganathan Sekar Date: Wed, 7 Feb 2024 16:08:19 +0530 Subject: [PATCH] Corrected otp freezing property names Signed-off-by: Loganathan Sekar --- .../common/service/integration/OTPManager.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java index 8b1ca346976..3e40f7a8157 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java @@ -70,10 +70,10 @@ public class OTPManager { @Autowired private NotificationService notificationService; - @Value("${mosip.ida.otp.validation-attempt-threshold:5}") + @Value("${mosip.ida.otp.validation.attempt.count.threshold:5}") private int numberOfValidationAttemptsAllowed; - @Value("${mosip.ida.otp.frozen.time.minutes:30}") + @Value("${mosip.ida.otp.frozen.duration.minutes:30}") private int otpFrozenTimeMinutes; /** The logger. */ @@ -207,13 +207,12 @@ public boolean validateOtp(String pinValue, String otpKey, String individualId) } } + // Increment the validation attempt count. int attemptCount = otpEntity.getValidationRetryCount() == null ? 1 : otpEntity.getValidationRetryCount() + 1; - //Optional otpTxnOpt = otpRepo.findByOtpHashAndStatusCode(otpHash, IdAuthCommonConstants.ACTIVE_STATUS); if(otpEntity.getStatusCode().equals(IdAuthCommonConstants.ACTIVE_STATUS)) { String otpHash = getOtpHash(pinValue, otpKey); if (otpEntity.getOtpHash().equals(otpHash)) { - //OtpTransaction otpTxn = otpRepo.findByOtpHashAndStatusCode(otpHash, IdAuthCommonConstants.ACTIVE_STATUS); otpEntity.setUpdDTimes(DateUtils.getUTCCurrentDateTime()); otpEntity.setStatusCode(IdAuthCommonConstants.USED_STATUS); otpRepo.save(otpEntity); @@ -225,7 +224,7 @@ public boolean validateOtp(String pinValue, String otpKey, String individualId) throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.EXPIRED_OTP); } } else { - // This condition increases the validation attempt count. + //Set the incremented validation attempt count otpEntity.setValidationRetryCount(attemptCount); if (attemptCount >= numberOfValidationAttemptsAllowed) { otpEntity.setStatusCode(IdAuthCommonConstants.FROZEN);