mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 09:02:45 +08:00
Change for #1706 to debug more
This commit is contained in:
parent
e3c53f8044
commit
16cc17af00
1 changed files with 32 additions and 21 deletions
|
@ -144,28 +144,34 @@ abstract class Account implements \JsonSerializable
|
|||
{
|
||||
$oAccount = null;
|
||||
$aAccountHash = static::convertArray($aAccountHash);
|
||||
if (!empty($aAccountHash['email']) && !empty($aAccountHash['login']) && !empty($aAccountHash['pass'])) {
|
||||
try {
|
||||
$oDomain = $oActions->DomainProvider()->getByEmailAddress($aAccountHash['email']);
|
||||
if ($oDomain) {
|
||||
// $aAccountHash['email'] = $oDomain->ImapSettings()->fixUsername($aAccountHash['email'], false);
|
||||
// $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->setImapPass(new SensitiveString($aAccountHash['pass']));
|
||||
$oAccount->oDomain = $oDomain;
|
||||
$oActions->Plugins()->RunHook('filter.account', array($oAccount));
|
||||
if ($bThrowExceptionOnFalse && !$oAccount) {
|
||||
throw new ClientException(Notifications::AccountFilterError);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
if ($bThrowExceptionOnFalse) {
|
||||
throw $e;
|
||||
}
|
||||
try {
|
||||
/*
|
||||
if (empty($aAccountHash['email'])) {
|
||||
throw new ClientException(Notifications::InvalidToken, null, 'TokenArray missing email');
|
||||
}
|
||||
if ($oAccount) {
|
||||
if (empty($aAccountHash['login'])) {
|
||||
throw new ClientException(Notifications::InvalidToken, null, 'TokenArray missing login');
|
||||
}
|
||||
if (empty($aAccountHash['pass'])) {
|
||||
throw new ClientException(Notifications::InvalidToken, null, 'TokenArray missing pass');
|
||||
}
|
||||
*/
|
||||
if (empty($aAccountHash['email']) || empty($aAccountHash['login']) || empty($aAccountHash['pass'])) {
|
||||
throw new \RuntimeException("Invalid TokenArray");
|
||||
}
|
||||
$oDomain = $oActions->DomainProvider()->getByEmailAddress($aAccountHash['email']);
|
||||
if ($oDomain) {
|
||||
// $aAccountHash['email'] = $oDomain->ImapSettings()->fixUsername($aAccountHash['email'], false);
|
||||
// $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->setImapPass(new SensitiveString($aAccountHash['pass']));
|
||||
$oAccount->oDomain = $oDomain;
|
||||
$oActions->Plugins()->RunHook('filter.account', array($oAccount));
|
||||
if (!$oAccount) {
|
||||
throw new ClientException(Notifications::AccountFilterError);
|
||||
}
|
||||
if (isset($aAccountHash['name'])) {
|
||||
$oAccount->sName = $aAccountHash['name'];
|
||||
}
|
||||
|
@ -177,6 +183,11 @@ abstract class Account implements \JsonSerializable
|
|||
$oAccount->setSmtpPass(new SensitiveString($aAccountHash['smtp']['pass']));
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\SnappyMail\Log::debug('ACCOUNT', $e->getMessage());
|
||||
if ($bThrowExceptionOnFalse) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
return $oAccount;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue