PasswordResetService
class PasswordResetService (View source)
Password reset by email: issues and rate-limits tokens, validates them and stores the new password.
Methods
__construct(PasswordResetTokenRepositoryInterface $tokenRepository, UserLookupInterface&UserCredentialWriterInterface $userRepository, MailService $mailService, ConfigurationInterface $config, UserAuthenticationService $authService, ClientContext $client, LoggerInterface $logger, UrlService $urlService)
No description
bool
isEnabled()
Check if password reset is enabled
array
canUserResetPassword(string $email)
Check if a user's authentication method allows password reset
bool
createResetRequest(string $email)
Create a password reset request
array|null
validateToken(string $token)
Validate a password reset token
bool
resetPassword(string $token, string $newPassword)
Reset password using a valid token
void
cleanupExpiredTokens()
Clean up expired tokens
Details
__construct(PasswordResetTokenRepositoryInterface $tokenRepository, UserLookupInterface&UserCredentialWriterInterface $userRepository, MailService $mailService, ConfigurationInterface $config, UserAuthenticationService $authService, ClientContext $client, LoggerInterface $logger, UrlService $urlService)
No description
bool
isEnabled()
Check if password reset is enabled
array
canUserResetPassword(string $email)
Check if a user's authentication method allows password reset
bool
createResetRequest(string $email)
Create a password reset request
array|null
validateToken(string $token)
Validate a password reset token
bool
resetPassword(string $token, string $newPassword)
Reset password using a valid token
void
cleanupExpiredTokens()
Clean up expired tokens
This method can be called from anywhere to clean up expired tokens. It's automatically called during:
- Creating new password reset requests
- Validating tokens
- Successful password resets