diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index 205d9f703..8510bb3bd 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -98,13 +98,15 @@ public function ServiceJson() : string $token = Utils::GetCsrfToken(); if (isset($_SERVER['HTTP_X_SM_TOKEN'])) { if ($_SERVER['HTTP_X_SM_TOKEN'] !== $token) { - $sEmail = $this->oActions->getAccountFromToken(false)->Email(); + $oAccount = $this->oActions->getAccountFromToken(false); + $sEmail = $oAccount ? $oAccount->Email() : 'guest'; $this->oActions->logWrite("{$_SERVER['HTTP_X_SM_TOKEN']} !== {$token} for {$sEmail}", \LOG_ERROR, 'Token'); throw new Exceptions\ClientException(Notifications::InvalidToken, null, 'HTTP Token mismatch'); } } else if ($this->oHttp->IsPost()) { if (empty($_POST['XToken']) || $_POST['XToken'] !== $token) { - $sEmail = $this->oActions->getAccountFromToken(false)->Email(); + $oAccount = $this->oActions->getAccountFromToken(false); + $sEmail = $oAccount ? $oAccount->Email() : 'guest'; $this->oActions->logWrite("{$_POST['XToken']} !== {$token} for {$sEmail}", \LOG_ERROR, 'XToken'); throw new Exceptions\ClientException(Notifications::InvalidToken, null, 'XToken mismatch'); }