mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
Resolve #1706
This commit is contained in:
parent
6f2f40b983
commit
b86743de24
2 changed files with 11 additions and 11 deletions
|
|
@ -141,21 +141,23 @@ trait UserAuth
|
||||||
*/
|
*/
|
||||||
public function LoginProcess(string $sEmail, SensitiveString $oPassword, bool $bMainAccount = true): Account
|
public function LoginProcess(string $sEmail, SensitiveString $oPassword, bool $bMainAccount = true): Account
|
||||||
{
|
{
|
||||||
$sCredentials = $this->resolveLoginCredentials($sEmail, $oPassword);
|
$aCredentials = $this->resolveLoginCredentials($sEmail, $oPassword);
|
||||||
|
|
||||||
if (!\str_contains($sCredentials['email'], '@') || !\strlen($oPassword)) {
|
if (!\str_contains($aCredentials['email'], '@') || !\strlen($oPassword)) {
|
||||||
throw new ClientException(Notifications::InvalidInputArgument);
|
throw new ClientException(Notifications::InvalidInputArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oDomain = $this->DomainProvider()->getByEmailAddress($aCredentials['email']);
|
||||||
|
|
||||||
$oAccount = null;
|
$oAccount = null;
|
||||||
try {
|
try {
|
||||||
$oAccount = $bMainAccount ? new MainAccount : new AdditionalAccount;
|
$oAccount = $bMainAccount ? new MainAccount : new AdditionalAccount;
|
||||||
$oAccount->setCredentials(
|
$oAccount->setCredentials(
|
||||||
$sCredentials['domain'],
|
$aCredentials['domain'],
|
||||||
$sCredentials['email'],
|
$aCredentials['email'],
|
||||||
$sCredentials['imapUser'],
|
$aCredentials['imapUser'],
|
||||||
$oPassword,
|
$oPassword,
|
||||||
$sCredentials['smtpUser']
|
$aCredentials['smtpUser']
|
||||||
// ,new SensitiveString($oPassword)
|
// ,new SensitiveString($oPassword)
|
||||||
);
|
);
|
||||||
$this->Plugins()->RunHook('filter.account', array($oAccount));
|
$this->Plugins()->RunHook('filter.account', array($oAccount));
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace RainLoop\Providers;
|
namespace RainLoop\Providers;
|
||||||
|
|
||||||
|
use RainLoop\Notifications;
|
||||||
use RainLoop\Exceptions\ClientException;
|
use RainLoop\Exceptions\ClientException;
|
||||||
|
|
||||||
class Domain extends AbstractProvider
|
class Domain extends AbstractProvider
|
||||||
|
|
@ -80,13 +81,10 @@ class Domain extends AbstractProvider
|
||||||
{
|
{
|
||||||
$oDomain = $this->Load(\MailSo\Base\Utils::getEmailAddressDomain($sEmail), true);
|
$oDomain = $this->Load(\MailSo\Base\Utils::getEmailAddressDomain($sEmail), true);
|
||||||
if (!$oDomain) {
|
if (!$oDomain) {
|
||||||
$this->logWrite("{$sEmail} has no domain configuration", \LOG_INFO, 'domain');
|
throw new ClientException(Notifications::DomainNotAllowed, null, "{$sEmail} has no domain configuration");
|
||||||
throw new ClientException(Notifications::DomainNotAllowed);
|
|
||||||
}
|
}
|
||||||
if (!$oDomain->ValidateWhiteList($sEmail)) {
|
if (!$oDomain->ValidateWhiteList($sEmail)) {
|
||||||
$this->logWrite("{$sEmail} not whitelisted in {$oDomain->Name()}", \LOG_WARNING, 'domain');
|
throw new ClientException(Notifications::AccountNotAllowed, null, "{$sEmail} not whitelisted");
|
||||||
throw new ClientException(Notifications::AccountNotAllowed);
|
|
||||||
// throw new ClientException(Notifications::AccountNotAllowed, null, "{$sEmail} not whitelisted in {$oDomain->Name()}");
|
|
||||||
}
|
}
|
||||||
return $oDomain;
|
return $oDomain;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue