This commit is contained in:
the-djmaze 2024-10-08 22:52:33 +02:00
parent 6f2f40b983
commit b86743de24
2 changed files with 11 additions and 11 deletions

View file

@ -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));

View file

@ -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;
}