]> source.dussan.org Git - nextcloud-server.git/commitdiff
Send emails on password reset to the displayname 25709/head
authorJoas Schilling <coding@schilljs.com>
Thu, 18 Feb 2021 11:38:43 +0000 (12:38 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 18 Feb 2021 14:35:06 +0000 (14:35 +0000)
Signed-off-by: Joas Schilling <coding@schilljs.com>
core/Controller/LostController.php
tests/Core/Controller/LostControllerTest.php

index 0a2e8d6b73da85d28fbb6cb8586c6b526a4f6ee4..edecc1cd8c7bf4797736a1e4f1c62945a6397bb9 100644 (file)
@@ -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);
index 4742e7ae4250b4f39ed0aa30a8d5e00cacf6742a..fd4e27d47f1b4cb0ec016d926729597bdf21888e 100644 (file)
@@ -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')