Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Resolve #1706
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Oct 8, 2024
1 parent 6f2f40b commit b86743d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 8 additions & 6 deletions snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,23 @@ protected function resolveLoginCredentials(string $sEmail, SensitiveString $oPas
*/
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace RainLoop\Providers;

use RainLoop\Notifications;
use RainLoop\Exceptions\ClientException;

class Domain extends AbstractProvider
Expand Down Expand Up @@ -80,13 +81,10 @@ public function getByEmailAddress(string $sEmail) : \RainLoop\Model\Domain
{
$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;
}
Expand Down

0 comments on commit b86743d

Please sign in to comment.