Skip to content

Commit 8fa780b

Browse files
authored
Merge pull request #39992 from nextcloud/backport/39770/stable25
[stable25] fix: always use display name from correct backend
2 parents cddcba4 + 40056c8 commit 8fa780b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/private/Accounts/AccountManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
use OCP\Mail\IMailer;
6262
use OCP\Security\ICrypto;
6363
use OCP\Security\VerificationToken\IVerificationToken;
64+
use OCP\User\Backend\IGetDisplayNameBackend;
6465
use OCP\Util;
6566
use Psr\Log\LoggerInterface;
6667
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -791,6 +792,10 @@ public function getAccount(IUser $user): IAccount {
791792
return $this->internalCache->get($user->getUID());
792793
}
793794
$account = $this->parseAccountData($user, $this->getUser($user));
795+
if ($user->getBackend() instanceof IGetDisplayNameBackend) {
796+
$property = $account->getProperty(self::PROPERTY_DISPLAYNAME);
797+
$account->setProperty(self::PROPERTY_DISPLAYNAME, $user->getDisplayName(), $property->getScope(), $property->getVerified());
798+
}
794799
$this->internalCache->set($user->getUID(), $account);
795800
return $account;
796801
}

0 commit comments

Comments
 (0)