mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Bugfix: Call to a member function Email() on null #1706
This commit is contained in:
parent
1ad946d013
commit
082dd3af41
|
@ -98,13 +98,15 @@ class ServiceActions
|
|||
$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');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue