Added support for the default domain

This commit is contained in:
RainLoop Team 2014-01-24 18:12:11 +04:00
parent 1ca90a8d7a
commit 6ca3b44d05
3 changed files with 11 additions and 8 deletions

View file

@ -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);
}
/**

View file

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