Tracks different kinds of (invalid) attempts within a specific period. More...
Public Member Functions | |
| AttemptsTracker (int a_maxAttempts, int a_expiryForAttemptsSeconds, int a_baseLockTimeSeconds) | |
| void | addAttempt () |
| Adds an attempt. | |
| bool | isLocked () |
| checks if the max number of attempts have been reached within the given | |
Tracks different kinds of (invalid) attempts within a specific period.
To use this class, create an instance and then call addAttempt() everytime a bad attempt is made. Then you can check if the allowable number of attempts has been exceeded.
AttemptsTracker at; ... //... Some attempt at a resource that might need to be tracked if (at.isLocked()) return; // ... Perform validation, if validation fails at.addAttempt();