Subversion Repositories SmartDukaan

Rev

Rev 37194 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37194 Rev 37632
Line 82... Line 82...
82
            otpResponse.setResult(false);
82
            otpResponse.setResult(false);
83
            otpResponse.setMessage("Maximum limit reached for the day");
83
            otpResponse.setMessage("Maximum limit reached for the day");
84
            return otpResponse;
84
            return otpResponse;
85
        }
85
        }
86
        LOGGER.info("Try to check otps isEmpty", otps.isEmpty());
86
        LOGGER.info("Try to check otps isEmpty", otps.isEmpty());
-
 
87
        // The resend throttle / code reuse only applies to an OTP that is still usable. A verified one is
-
 
88
        // spent, so handing it back ("generated less than 2 minutes ago") would leave the user with no
-
 
89
        // working OTP - e.g. an LOI re-sign straight after the signed PDF failed to save.
87
        if (!otps.isEmpty()) {
90
        if (!otps.isEmpty() && !otps.get(0).isVerified()) {
88
            if (otps.get(0).getCreatedOn().isAfter(LocalDateTime.now().minusMinutes(2))) {
91
            if (otps.get(0).getCreatedOn().isAfter(LocalDateTime.now().minusMinutes(2))) {
89
                otpResponse.setMessage("OTP generated less than 2 minutes ago");
92
                otpResponse.setMessage("OTP generated less than 2 minutes ago");
90
                otpResponse.setReference_id(otps.get(0).getId());
93
                otpResponse.setReference_id(otps.get(0).getId());
91
                otpResponse.setResult(true);
94
                otpResponse.setResult(true);
92
                otpResponse.setOtp(otps.get(0).getOtp());
95
                otpResponse.setOtp(otps.get(0).getOtp());