class LoginAttemptService (View source)

A service for tracking and acting upon login attempts This service is NOT in charge of logging in users, it is meant to react to attempts

Properties

protected EntityManagerInterface $entityManager The entitymanager we're tracking attempts with
protected Repository $config The config repository that has configuration for this service
protected EventDispatcherInterface $director The event dispatcher we use to send out events
protected LoginAttempt[] $batch The currently waiting login attempts
protected array $knownUsers A cache for known users

Methods

__construct(EntityManagerInterface $entityManager, Repository $config, EventDispatcherInterface $director)

No description

$this
trackAttempt(string $username, string $password)

Track a login attempt for a user

int
remainingAttempts($username)

Determine the amount of attempts remaining for a username

deactivate($username)

Deactivate a given username

pruneAttempts(DateTime $before = null)

Prune old login attempts

array
manageBatch(array $batch, int $max)

Manage a batched ORM operation

User|null
resolveUser($username)

Resolve the user from username / user email

Details

__construct(EntityManagerInterface $entityManager, Repository $config, EventDispatcherInterface $director)

Parameters

EntityManagerInterface $entityManager
Repository $config
EventDispatcherInterface $director

$this trackAttempt(string $username, string $password)

Track a login attempt for a user

Parameters

string $username
string $password

Return Value

$this

int remainingAttempts($username)

Determine the amount of attempts remaining for a username

Parameters

$username

Return Value

int

deactivate($username)

Deactivate a given username

Parameters

$username

pruneAttempts(DateTime $before = null)

Prune old login attempts

Parameters

DateTime $before The date to prune before. This MUST be in UTC, if not passed this value is derived from config

private array manageBatch(array $batch, int $max)

Manage a batched ORM operation

Parameters

array $batch
int $max

Return Value

array

private User|null resolveUser($username)

Resolve the user from username / user email

Parameters

$username

Return Value

User|null