recordAttempt method

bool recordAttempt()

Record an attempt. Returns true if attempt is allowed, false if locked out.

Implementation

bool recordAttempt() {
  if (isLockedOut) return false;

  _attempts++;

  if (maxAttempts > 0 && _attempts >= maxAttempts) {
    _lockoutUntil = DateTime.now().add(lockoutDuration);
    if (OTPSecurityConfig.enableSecurityLogging) {
      debugPrint(
        '[SAC OTP Security] Max attempts reached, locked out for ${lockoutDuration.inSeconds}s',
      );
    }
    return false;
  }

  return true;
}