UsernameRecoveryService
class UsernameRecoveryService (View source)
Methods
__construct(DbUsernameRecoveryRepository $recoveryRepository, MailService $mailService, ConfigurationInterface $config, IpAddressRetriever $ipRetriever, LoggerInterface $logger, PDO $db)
No description
bool
isEnabled()
Check if username recovery is enabled
bool
createRecoveryRequest(string $email)
Create a username recovery request
void
cleanupOldRequests(int $days = 30)
Clean up old recovery request records
Details
__construct(DbUsernameRecoveryRepository $recoveryRepository, MailService $mailService, ConfigurationInterface $config, IpAddressRetriever $ipRetriever, LoggerInterface $logger, PDO $db)
No description
bool
isEnabled()
Check if username recovery is enabled
bool
createRecoveryRequest(string $email)
Create a username recovery request
This method handles the entire username recovery flow:
- Validates rate limits
- Finds all accounts associated with the email
- Sends recovery email with username information
- Records the request for rate limiting
Security: Always returns true to prevent email enumeration attacks
void
cleanupOldRequests(int $days = 30)
Clean up old recovery request records
This method can be called periodically to clean up old records. Default: Delete records older than 30 days