DbLoginAttemptRepository
final class DbLoginAttemptRepository implements LoginAttemptRepositoryInterface (View source)
SQL persistence for the authentication throttle counters in login_attempts.
Methods
Whether the attempt_type column exists, which it does not between a code deploy and the 4.5.0 SQL update.
Resolve the account an attempt belongs to, or null when the username is unknown.
Record one attempt. A null $attemptType omits the stage column entirely.
Count the failures for an account since $cutoffTime. A null $attemptType counts every stage, a null $ipAddress counts every source address.
Drop the failures for an account, scoped the same way the counting is.
Prune every attempt recorded before $cutoffTime.
Details
__construct(PDO $connection, ConfigurationInterface $config)
No description
bool
hasAttemptTypeColumn()
Whether the attempt_type column exists, which it does not between a code deploy and the 4.5.0 SQL update.
int|null
findUserIdByUsername(string $username)
Resolve the account an attempt belongs to, or null when the username is unknown.
void
record(int|null $userId, string $ipAddress, int $timestamp, bool $successful, string|null $attemptType)
Record one attempt. A null $attemptType omits the stage column entirely.
int
countFailedAttempts(int $userId, int $cutoffTime, string|null $attemptType, string|null $ipAddress)
Count the failures for an account since $cutoffTime. A null $attemptType counts every stage, a null $ipAddress counts every source address.
void
clearFailedAttempts(int $userId, string|null $attemptType, string|null $ipAddress)
Drop the failures for an account, scoped the same way the counting is.
void
deleteOlderThan(int $cutoffTime)
Prune every attempt recorded before $cutoffTime.