Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/Controller/LostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public function resetform($token, $userId) {
*/
protected function checkPasswordResetToken(string $token, string $userId): void {
try {
$this->verificationToken->check($token, $this->userManager->get($userId), 'lostpassword', '', true);
$user = $this->userManager->get($userId);
$this->verificationToken->check($token, $user, 'lostpassword', $user ? $user->getEMailAddress() : '', true);
} catch (InvalidTokenException $e) {
$error = $e->getCode() === InvalidTokenException::TOKEN_EXPIRED
? $this->l10n->t('Could not reset password because the token is expired')
Expand Down
7 changes: 5 additions & 2 deletions tests/Core/Controller/LostControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function testResetFormTokenError() {
->willReturn($this->existingUser);
$this->verificationToken->expects($this->once())
->method('check')
->with('12345:MySecretToken', $this->existingUser, 'lostpassword')
->with('12345:MySecretToken', $this->existingUser, 'lostpassword', '[email protected]')
->willThrowException(new InvalidTokenException(InvalidTokenException::TOKEN_DECRYPTION_ERROR));

$response = $this->lostController->resetform('12345:MySecretToken', 'ValidTokenUser');
Expand All @@ -174,7 +174,7 @@ public function testResetFormValidToken() {
->willReturn($this->existingUser);
$this->verificationToken->expects($this->once())
->method('check')
->with('MySecretToken', $this->existingUser, 'lostpassword');
->with('MySecretToken', $this->existingUser, 'lostpassword', '[email protected]');

$response = $this->lostController->resetform('MySecretToken', 'ValidTokenUser');
$expectedResponse = new TemplateResponse('core',
Expand Down Expand Up @@ -513,6 +513,9 @@ public function testSetPasswordForDisabledUser() {
->willReturn(false);
$user->expects($this->never())
->method('setPassword');
$user->expects($this->any())
->method('getEMailAddress')
->willReturn('[email protected]');

$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
Expand Down