interface PasswordResetTokenRepositoryInterface (View source)

Persistence for password reset tokens and their rate-limit counters.

Methods

bool
create(array $data)

Store a reset token. The raw token is supplied; the implementation stores its hash and findByToken() expects that same hash.

array|null
findByToken(string $token)

Find an unused, unexpired token by its hashed value.

bool
markAsUsed(int $tokenId)

Mark a token as used. Returns false when the token was already used.

bool
releaseClaim(int $tokenId)

Undo markAsUsed() after the password change it guarded failed, so the link works again.

int
countRecentAttempts(string $email, int $seconds)

Count recent attempts for an email address.

int
countRecentAttemptsByIp(string $ip, int $seconds)

Count recent attempts by IP address.

int
deleteExpired()

Delete expired tokens and used tokens past their retention window.

bool
deleteById(int $tokenId)

Delete a specific token by ID.

Details

bool create(array $data)

Store a reset token. The raw token is supplied; the implementation stores its hash and findByToken() expects that same hash.

Parameters

array $data

Token row: email, token, expires_at, ip_address

Return Value

bool

array|null findByToken(string $token)

Find an unused, unexpired token by its hashed value.

Parameters

string $token

Return Value

array|null

bool markAsUsed(int $tokenId)

Mark a token as used. Returns false when the token was already used.

Parameters

int $tokenId

Return Value

bool

bool releaseClaim(int $tokenId)

Undo markAsUsed() after the password change it guarded failed, so the link works again.

Parameters

int $tokenId

Return Value

bool

int countRecentAttempts(string $email, int $seconds)

Count recent attempts for an email address.

Parameters

string $email
int $seconds

Return Value

int

int countRecentAttemptsByIp(string $ip, int $seconds)

Count recent attempts by IP address.

Parameters

string $ip
int $seconds

Return Value

int

int deleteExpired()

Delete expired tokens and used tokens past their retention window.

Return Value

int

Number of deleted rows

bool deleteById(int $tokenId)

Delete a specific token by ID.

Parameters

int $tokenId

Return Value

bool