SendVerificationEmail
in package
Use case for sending an email verification link.
Generates a secure token, stores it hashed in the database, and sends the verification link via email. When email is disabled, auto-verifies the user and logs the token.
Tags
Table of Contents
Constants
- TOKEN_EXPIRY_HOURS = 24
Properties
Methods
- __construct() : mixed
- execute() : bool
- Send a verification email to the given user.
Constants
TOKEN_EXPIRY_HOURS
private
mixed
TOKEN_EXPIRY_HOURS
= 24
Properties
$emailService
private
EmailService
$emailService
$repository
private
UserRepositoryInterface
$repository
$tokenHasher
private
TokenHasher
$tokenHasher
Methods
__construct()
public
__construct(UserRepositoryInterface $repository, TokenHasher $tokenHasher, EmailService $emailService) : mixed
Parameters
- $repository : UserRepositoryInterface
- $tokenHasher : TokenHasher
- $emailService : EmailService
execute()
Send a verification email to the given user.
public
execute(User $user) : bool
If email is disabled, the user is auto-verified.
Parameters
- $user : User
-
The user to verify
Return values
bool —True if sent or auto-verified