ResetPasswordWithRecoveryCode
in package
Reset a password using a one-time recovery code.
Tags
Table of Contents
Constants
- INVALID_MESSAGE = 'Invalid username or recovery code.'
- Generic message used for every failure, to avoid leaking which part was wrong.
Properties
- $passwordHasher : PasswordHasher
- $recoveryCodes : RecoveryCodeService
- $repository : UserRepositoryInterface
Methods
- __construct() : mixed
- execute() : string
- Reset the password and rotate the recovery code.
Constants
INVALID_MESSAGE
Generic message used for every failure, to avoid leaking which part was wrong.
public
mixed
INVALID_MESSAGE
= 'Invalid username or recovery code.'
Properties
$passwordHasher
private
PasswordHasher
$passwordHasher
$recoveryCodes
private
RecoveryCodeService
$recoveryCodes
$repository
private
UserRepositoryInterface
$repository
Methods
__construct()
public
__construct(UserRepositoryInterface $repository[, RecoveryCodeService|null $recoveryCodes = null ][, PasswordHasher|null $passwordHasher = null ]) : mixed
Parameters
- $repository : UserRepositoryInterface
- $recoveryCodes : RecoveryCodeService|null = null
- $passwordHasher : PasswordHasher|null = null
execute()
Reset the password and rotate the recovery code.
public
execute(string $username, string $code, string $newPassword) : string
Parameters
- $username : string
-
The account username.
- $code : string
-
The recovery code as typed by the user.
- $newPassword : string
-
The new password.
Tags
Return values
string —The new recovery code (plaintext, shown once).