Skip to content

Commit 8545afe

Browse files
committed
fix: ensure user object is available for email reset
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent 50bb4a8 commit 8545afe

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/Repair/ResetEmails.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ public function run(IOutput $output) {
3939

4040
foreach ($this->guestManager->listGuests() as $guestId) {
4141
$guest = $this->userManager->get($guestId);
42+
if ($guest === null) {
43+
continue;
44+
}
45+
4246
$expectedEmail = $this->config->getUserValue($guestId, Application::APP_ID, 'email', strtolower($guestId));
43-
if (strtolower($guest?->getSystemEMailAddress() ?? '') !== $expectedEmail) {
44-
$this->config->setUserValue($guestId, 'guests', 'old_email', $guest?->getSystemEMailAddress() ?? '');
47+
$currentEmail = $guest->getSystemEMailAddress() ?? '';
48+
49+
if (strtolower($currentEmail) !== $expectedEmail) {
50+
$this->config->setUserValue($guestId, 'guests', 'old_email', $currentEmail);
4551
$guest->setSystemEMailAddress($expectedEmail);
4652
}
4753
}

0 commit comments

Comments
 (0)