mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Added support for the default domain
This commit is contained in:
parent
1ca90a8d7a
commit
6ca3b44d05
3 changed files with 11 additions and 8 deletions
|
|
@ -313,9 +313,10 @@ class Actions
|
|||
$oAccount = $this->getAccountFromToken(false);
|
||||
if ($oAccount)
|
||||
{
|
||||
$sFileName = \str_replace('{user:email}', \strtolower($oAccount->Email()), $sFileName);
|
||||
$sFileName = \str_replace('{user:login}', $oAccount->IncLogin(), $sFileName);
|
||||
$sFileName = \str_replace('{user:domain}', \strtolower($oAccount->Domain()->Name()), $sFileName);
|
||||
$sEmail = \strtolower($oAccount->Email());
|
||||
$sFileName = \str_replace('{user:email}', $sEmail, $sFileName);
|
||||
$sFileName = \str_replace('{user:login}', \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail), $sFileName);
|
||||
$sFileName = \str_replace('{user:domain}', \MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sFileName);
|
||||
}
|
||||
|
||||
$sFileName = \preg_replace('/\{user:([^}]*)\}/', 'unknown', $sFileName);
|
||||
|
|
@ -834,7 +835,7 @@ class Actions
|
|||
}
|
||||
else
|
||||
{
|
||||
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]));
|
||||
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]), true);
|
||||
if ($bThrowExceptionOnFalse)
|
||||
{
|
||||
if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled())
|
||||
|
|
@ -1288,7 +1289,7 @@ class Actions
|
|||
{
|
||||
$this->loginErrorDelay();
|
||||
|
||||
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail));
|
||||
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
|
||||
if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled())
|
||||
{
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
|
||||
|
|
|
|||
|
|
@ -35,12 +35,14 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param bool $bDefaultOnNull = false
|
||||
*
|
||||
* @return \RainLoop\Domain | null
|
||||
*/
|
||||
public function Load($sName)
|
||||
public function Load($sName, $bDefaultOnNull = false)
|
||||
{
|
||||
return $this->oDriver->Load($sName);
|
||||
$oDomain = $this->oDriver->Load($sName);
|
||||
return $oDomain ? $oDomain : ($bDefaultOnNull ? $this->oDriver->Load('default') : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Login extends \RainLoop\Providers\AbstractProvider
|
|||
|
||||
if ($this->oDriver->ProvideParameters($sEmail, $sLogin, $sPassword))
|
||||
{
|
||||
$oDomain = $this->oDomainProvider->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail));
|
||||
$oDomain = $this->oDomainProvider->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
|
||||
if ($oDomain instanceof \RainLoop\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin))
|
||||
{
|
||||
$oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue