mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +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
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
$oDomain = $this->DomainProvider()->getByEmailAddress($aCredentials['email']);
|
||||
|
||||
$oAccount = null;
|
||||
try {
|
||||
$oAccount = $bMainAccount ? new MainAccount : new AdditionalAccount;
|
||||
$oAccount->setCredentials(
|
||||
$sCredentials['domain'],
|
||||
$sCredentials['email'],
|
||||
$sCredentials['imapUser'],
|
||||
$aCredentials['domain'],
|
||||
$aCredentials['email'],
|
||||
$aCredentials['imapUser'],
|
||||
$oPassword,
|
||||
$sCredentials['smtpUser']
|
||||
$aCredentials['smtpUser']
|
||||
// ,new SensitiveString($oPassword)
|
||||
);
|
||||
$this->Plugins()->RunHook('filter.account', array($oAccount));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers;
|
||||
|
||||
use RainLoop\Notifications;
|
||||
use RainLoop\Exceptions\ClientException;
|
||||
|
||||
class Domain extends AbstractProvider
|
||||
|
|
@ -80,13 +81,10 @@ 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);
|
||||
throw new ClientException(Notifications::DomainNotAllowed, null, "{$sEmail} has no domain configuration");
|
||||
}
|
||||
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()}");
|
||||
throw new ClientException(Notifications::AccountNotAllowed, null, "{$sEmail} not whitelisted");
|
||||
}
|
||||
return $oDomain;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue