Skip to content

Commit

Permalink
Bugfix: Call to a member function Email() on null #1706
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Aug 27, 2024
1 parent 1ad946d commit 082dd3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 082dd3a

Please sign in to comment.