summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2021-02-23 11:58:09 +0100
committerGitHub <noreply@github.com>2021-02-23 11:58:09 +0100
commited262743e81cacd425eade1d17f3a1550566cf0a (patch)
treebe21153338eda4ef93ae968e503239a03b02df49
parent33cebe106afb6fd028100a50f56b767a58f380d1 (diff)
parent21e9e439e6eeb6e93a821ff09b269daeb39d8549 (diff)
downloadnextcloud-server-ed262743e81cacd425eade1d17f3a1550566cf0a.tar.gz
nextcloud-server-ed262743e81cacd425eade1d17f3a1550566cf0a.zip
Merge pull request #25710 from nextcloud/backport/25707/stable19
[stable19] Send emails on password reset to the displayname
-rw-r--r--core/Controller/LostController.php2
-rw-r--r--tests/Core/Controller/LostControllerTest.php9
2 files changed, 7 insertions, 4 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 0a2e8d6b73d..edecc1cd8c7 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 09f224131f5..88651f4959f 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -95,6 +95,9 @@ class LostControllerTest extends \Test\TestCase {
->method('getUID')
->willReturn('ExistingUser');
$this->existingUser->expects($this->any())
+ ->method('getDisplayName')
+ ->willReturn('Existing User');
+ $this->existingUser->expects($this->any())
->method('isEnabled')
->willReturn(true);
@@ -345,7 +348,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')
@@ -423,7 +426,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')
@@ -495,7 +498,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')