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

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.

Details

bool hasAttemptTypeColumn()

Whether the attempt_type column exists, which it does not between a code deploy and the 4.5.0 SQL update.

Return Value

bool

int|null findUserIdByUsername(string $username)

Resolve the account an attempt belongs to, or null when the username is unknown.

Parameters

string $username

Return Value

int|null

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.

Parameters

int|null $userId
string $ipAddress
int $timestamp
bool $successful
string|null $attemptType

Return Value

void

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.

Parameters

int $userId
int $cutoffTime
string|null $attemptType
string|null $ipAddress

Return Value

int

void clearFailedAttempts(int $userId, string|null $attemptType, string|null $ipAddress)

Drop the failures for an account, scoped the same way the counting is.

Parameters

int $userId
string|null $attemptType
string|null $ipAddress

Return Value

void

void deleteOlderThan(int $cutoffTime)

Prune every attempt recorded before $cutoffTime.

Parameters

int $cutoffTime

Return Value

void