final class DbLoginAttemptRepository implements LoginAttemptRepositoryInterface (View source)

SQL persistence for the authentication throttle counters in login_attempts.

Methods

__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.

Details

__construct(PDO $connection, ConfigurationInterface $config)

No description

Parameters

PDO $connection
ConfigurationInterface $config

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