LoginAttemptRepositoryInterface
interface LoginAttemptRepositoryInterface (View source)
Persistence for the login_attempts counters the authentication throttle reads and writes.
The username lookup lives here rather than on the user repository because it is the throttle's own key resolution, and the throttle is built on paths that have no backend-mode wiring to hand it a full user repository.
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
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.