From 6ed4c604c717dc0cd4cf3257773ad912158be1fb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Feb 2021 12:38:43 +0100 Subject: [PATCH] Send emails on password reset to the displayname Signed-off-by: Joas Schilling --- core/Controller/LostController.php | 2 +- tests/Core/Controller/LostControllerTest.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 861a701fac..eedb9eef54 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -378,7 +378,7 @@ class LostController extends Controller { try { $message = $this->mailer->createMessage(); - $message->setTo([$email => $user->getUID()]); + $message->setTo([$email => $user->getDisplayName()]); $message->setFrom([$this->from => $this->defaults->getName()]); $message->useTemplate($emailTemplate); $this->mailer->send($message); diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 4742e7ae42..fd4e27d47f 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -93,6 +93,9 @@ class LostControllerTest extends \Test\TestCase { $this->existingUser->expects($this->any()) ->method('getUID') ->willReturn('ExistingUser'); + $this->existingUser->expects($this->any()) + ->method('getDisplayName') + ->willReturn('Existing User'); $this->existingUser->expects($this->any()) ->method('isEnabled') ->willReturn(true); @@ -344,7 +347,7 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(0)) ->method('setTo') - ->with(['test@example.com' => 'ExistingUser']); + ->with(['test@example.com' => 'Existing User']); $message ->expects($this->at(1)) ->method('setFrom') @@ -422,7 +425,7 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(0)) ->method('setTo') - ->with(['test@example.com' => 'ExistingUser']); + ->with(['test@example.com' => 'Existing User']); $message ->expects($this->at(1)) ->method('setFrom') @@ -494,7 +497,7 @@ class LostControllerTest extends \Test\TestCase { $message ->expects($this->at(0)) ->method('setTo') - ->with(['test@example.com' => 'ExistingUser']); + ->with(['test@example.com' => 'Existing User']); $message ->expects($this->at(1)) ->method('setFrom')