mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
Added the proper logging for #1706
This commit is contained in:
parent
ba85eda7f0
commit
28a8e3c157
6 changed files with 21 additions and 24 deletions
|
|
@ -69,6 +69,7 @@ trait Accounts
|
|||
}
|
||||
|
||||
/**
|
||||
* Add/Edit additional account
|
||||
* @throws \MailSo\RuntimeException
|
||||
*/
|
||||
public function DoAccountSetup(): array
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ trait UserAuth
|
|||
|
||||
// Test the login
|
||||
$oImapClient = new \MailSo\Imap\ImapClient;
|
||||
$oImapClient->SetLogger($this->Logger());
|
||||
$this->imapConnect($oAccount, false, $oImapClient);
|
||||
}
|
||||
$this->SetAdditionalAuthToken($oAccount);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ abstract class Account implements \JsonSerializable
|
|||
// $aAccountHash['login'] = $oDomain->ImapSettings()->fixUsername($aAccountHash['login']);
|
||||
$oAccount = new static;
|
||||
$oAccount->sEmail = \SnappyMail\IDN::emailToAscii($aAccountHash['email']);
|
||||
$oAccount->sImapUser = \SnappyMail\IDN::emailToAscii($aAccountHash['login']);
|
||||
// $oAccount->sImapUser = \SnappyMail\IDN::emailToAscii($aAccountHash['login']);
|
||||
$oAccount->sImapUser = $aAccountHash['login'];
|
||||
$oAccount->setImapPass(new SensitiveString($aAccountHash['pass']));
|
||||
$oAccount->oDomain = $oDomain;
|
||||
$oActions->Plugins()->RunHook('filter.account', array($oAccount));
|
||||
|
|
@ -286,7 +287,7 @@ abstract class Account implements \JsonSerializable
|
|||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @deprecated since v2.36.1
|
||||
*/
|
||||
public function IncLogin() : string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class Domain implements \JsonSerializable
|
|||
|
||||
public function ValidateWhiteList(string $sEmail) : bool
|
||||
{
|
||||
$sW = \trim($this->whiteList);
|
||||
$sW = $this->whiteList;
|
||||
if (!$sW) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ class Domain implements \JsonSerializable
|
|||
$oDomain->SMTP->setSender = !empty($aDomain['smtp_set_sender']);
|
||||
$oDomain->SMTP->usePhpMail = !empty($aDomain['smtp_php_mail']);
|
||||
|
||||
$oDomain->whiteList = \trim($aDomain['white_list'] ?? '');
|
||||
$oDomain->whiteList = $aDomain['white_list'] ?? '';
|
||||
|
||||
$oDomain->Normalize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,9 @@ use RainLoop\Exceptions\ClientException;
|
|||
|
||||
class Domain extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var Domain\DomainInterface
|
||||
*/
|
||||
private $oDriver;
|
||||
private Domain\DomainInterface $oDriver;
|
||||
|
||||
/**
|
||||
* @var \RainLoop\Plugins\Manager
|
||||
*/
|
||||
private $oPlugins;
|
||||
private \RainLoop\Plugins\Manager $oPlugins;
|
||||
|
||||
public function __construct(Domain\DomainInterface $oDriver, \RainLoop\Plugins\Manager $oPlugins)
|
||||
{
|
||||
|
|
@ -86,10 +80,13 @@ class Domain extends AbstractProvider
|
|||
{
|
||||
$oDomain = $this->Load(\MailSo\Base\Utils::getEmailAddressDomain($sEmail), true);
|
||||
if (!$oDomain) {
|
||||
$this->logWrite("{$sEmail} has no domain configuration", \LOG_INFO, 'domain');
|
||||
throw new ClientException(Notifications::DomainNotAllowed);
|
||||
}
|
||||
if (!$oDomain->ValidateWhiteList($sEmail)) {
|
||||
$this->logWrite("{$sEmail} not whitelisted in {$oDomain->Name()}", \LOG_WARNING, 'domain');
|
||||
throw new ClientException(Notifications::AccountNotAllowed);
|
||||
// throw new ClientException(Notifications::AccountNotAllowed, null, "{$sEmail} not whitelisted in {$oDomain->Name()}");
|
||||
}
|
||||
return $oDomain;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue