Documentation

RequestPasswordReset

Use case for requesting a password reset.

Generates a secure token, stores it hashed in the database, and sends the reset link via email.

Security considerations:

  • Tokens are generated using cryptographically secure random bytes
  • Only the SHA-256 hash is stored in the database
  • Tokens expire after 1 hour
  • Silent fail on invalid email (prevents user enumeration attacks)
Tags
since
3.0.0

Table of Contents

Constants

TOKEN_EXPIRY_HOURS  = 1
Token expiry time in hours.

Properties

$emailService  : EmailService
$repository  : UserRepositoryInterface
$tokenHasher  : TokenHasher

Methods

__construct()  : mixed
Create a new RequestPasswordReset use case.
execute()  : bool
Execute the password reset request.

Constants

Properties

Methods

execute()

Execute the password reset request.

public execute(string $email) : bool

Always returns true to prevent email enumeration attacks. If the email doesn't exist or the account is inactive, we silently succeed.

Parameters
$email : string

User's email address

Return values
bool

Always true (silent fail for security)


        
On this page

Search results