Added more plugin hooks

Added proxy auth plugin example (dev)
This commit is contained in:
RainLoop Team 2014-10-16 19:57:47 +04:00
parent 819ba4a2ef
commit 9c43105e95
8 changed files with 432 additions and 123 deletions

View file

@ -19,6 +19,16 @@ class Account
*/
private $sPassword;
/**
* @var string
*/
private $sProxyAuthUser;
/**
* @var string
*/
private $sProxyAuthPassword;
/**
* @var string
*/
@ -40,16 +50,21 @@ class Account
* @param string $sPassword
* @param \RainLoop\Domain $oDomain
* @param string $sSignMeToken = ''
* @param string $sProxyAuthUser = ''
* @param string $sProxyAuthPassword = ''
*
* @return void
*/
protected function __construct($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain, $sSignMeToken = '')
protected function __construct($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain,
$sSignMeToken = '', $sProxyAuthUser = '', $sProxyAuthPassword = '')
{
$this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
$this->sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
$this->sPassword = $sPassword;
$this->oDomain = $oDomain;
$this->sSignMeToken = $sSignMeToken;
$this->sProxyAuthUser = $sProxyAuthUser;
$this->sProxyAuthPassword = $sProxyAuthPassword;
}
/**
@ -58,12 +73,15 @@ class Account
* @param string $sPassword
* @param \RainLoop\Domain $oDomain
* @param string $sSignMeToken = ''
* @param string $sProxyAuthUser = ''
* @param string $sProxyAuthPassword = ''
*
* @return \RainLoop\Account
*/
public static function NewInstance($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain, $sSignMeToken = '')
public static function NewInstance($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain,
$sSignMeToken = '', $sProxyAuthUser = '', $sProxyAuthPassword = '')
{
return new self($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
return new self($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, $sProxyAuthUser, $sProxyAuthPassword);
}
/**
@ -81,6 +99,22 @@ class Account
{
return $this->sParentEmail;
}
/**
* @return string
*/
public function ProxyAuthUser()
{
return $this->sProxyAuthUser;
}
/**
* @return string
*/
public function ProxyAuthPassword()
{
return $this->sProxyAuthPassword;
}
/**
* @return string
@ -104,6 +138,14 @@ class Account
return $sLogin;
}
/**
* @return string
*/
public function IncPassword()
{
return $this->sPassword;
}
/**
* @return string
*/
@ -131,7 +173,7 @@ class Account
*/
public function Password()
{
return $this->sPassword;
return $this->IncPassword();
}
/**
@ -163,8 +205,8 @@ class Account
*/
public function Hash()
{
return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())).
APP_SALT.$this->oDomain->IncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT);
return md5(APP_SALT.$this->Email().APP_SALT.$this->DomainIncHost().
APP_SALT.$this->DomainIncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT);
}
/**
@ -187,20 +229,229 @@ class Account
$this->sParentEmail = \MailSo\Base\Utils::IdnToAscii($sParentEmail, true);
}
/**
* @param string $sProxyAuthUser
*
* @return void
*/
public function SetProxyAuthUser($sProxyAuthUser)
{
return $this->sProxyAuthUser = $sProxyAuthUser;
}
/**
* @param string $sProxyAuthPassword
*
* @return void
*/
public function SetProxyAuthPassword($sProxyAuthPassword)
{
return $this->sProxyAuthPassword = $sProxyAuthPassword;
}
/**
* @return string
*/
public function DomainIncHost()
{
return $this->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email()));
}
/**
* @return int
*/
public function DomainIncPort()
{
return $this->Domain()->IncPort();
}
/**
* @return int
*/
public function DomainIncSecure()
{
return $this->Domain()->IncSecure();
}
/**
* @param bool|null $bGlobalVerify = null
*
* @return bool
*/
public function DomainIncVerifySsl($bGlobalVerify = null)
{
return $this->Domain()->IncVerifySsl($bGlobalVerify);
}
/**
* @return string
*/
public function DomainOutHost()
{
return $this->Domain()->OutHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email()));
}
/**
* @return int
*/
public function DomainOutPort()
{
return $this->Domain()->OutPort();
}
/**
* @return int
*/
public function DomainOutSecure()
{
return $this->Domain()->OutSecure();
}
/**
* @return bool
*/
public function DomainOutAuth()
{
return $this->Domain()->OutAuth();
}
/**
* @param bool|null $bGlobalVerify = null
*
* @return bool
*/
public function DomainOutVerifySsl($bGlobalVerify = null)
{
return $this->Domain()->OutVerifySsl($bGlobalVerify);
}
/**
* @return string
*/
public function GetAuthToken()
{
return \RainLoop\Utils::EncodeKeyValues(array(
'token',
$this->sEmail,
$this->sLogin,
$this->sPassword,
\RainLoop\Utils::Fingerprint(),
$this->sSignMeToken,
$this->sParentEmail,
\RainLoop\Utils::GetShortToken()
'token', // 0
$this->sEmail, // 1
$this->sLogin, // 2
$this->sPassword, // 3
\RainLoop\Utils::Fingerprint(), // 4
$this->sSignMeToken, // 5
$this->sParentEmail, // 6
\RainLoop\Utils::GetShortToken(), // 7
$this->sProxyAuthUser, // 8
$this->sProxyAuthPassword // 9
));
}
/**
* @param \RainLoop\Plugins\Manager $oPlugins
* @param \MailSo\Mail\MailClient $oMailClient
* @param \RainLoop\Application $oConfig
*
* @return bool
*/
public function IncConnectAndLoginHelper($oPlugins, $oMailClient, $oConfig)
{
$bLogin = false;
$aImapCredentials = array(
'UseConnect' => true,
'UseAuth' => true,
'Host' => $this->DomainIncHost(),
'Port' => $this->DomainIncPort(),
'Secure' => $this->DomainIncSecure(),
'Login' => $this->IncLogin(),
'Password' => $this->Password(),
'ProxyAuthUser' => $this->ProxyAuthUser(),
'ProxyAuthPassword' => $this->ProxyAuthPassword(),
'VerifySsl' => $this->DomainIncVerifySsl(!!$oConfig->Get('ssl', 'verify_certificate')),
'UseAuthPlainIfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_plain')
);
$oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials));
$oPlugins->RunHook('event.imap-pre-connect', array($this, $aImapCredentials['UseConnect'], $aImapCredentials));
if ($aImapCredentials['UseConnect'])
{
$oMailClient
->Connect($aImapCredentials['Host'], $aImapCredentials['Port'],
$aImapCredentials['Secure'], $aImapCredentials['VerifySsl']);
}
$oPlugins->RunHook('event.imap-pre-login', array($this, $aImapCredentials['UseAuth'], $aImapCredentials));
if ($aImapCredentials['UseAuth'])
{
if (0 < \strlen($aImapCredentials['ProxyAuthUser']) &&
0 < \strlen($aImapCredentials['ProxyAuthPassword']))
{
$oMailClient
->Login($aImapCredentials['ProxyAuthUser'], $aImapCredentials['ProxyAuthPassword'],
$aImapCredentials['Login'], $aImapCredentials['UseAuthPlainIfSupported']);
}
else
{
$oMailClient->Login($aImapCredentials['Login'], $aImapCredentials['Password'], '',
$aImapCredentials['UseAuthPlainIfSupported']);
}
$bLogin = true;
}
$oPlugins->RunHook('event.imap-post-login', array($this, $aImapCredentials['UseAuth'], $bLogin, $aImapCredentials));
return $bLogin;
}
/**
* @param \RainLoop\Plugins\Manager $oPlugins
* @param \MailSo\Smtp\SmtpClient $oSmtpClient
* @param \RainLoop\Application $oConfig
*
* @return bool
*/
public function OutConnectAndLoginHelper($oPlugins, $oSmtpClient, $oConfig)
{
$bLogin = false;
$aSmtpCredentials = array(
'UseConnect' => true,
'UseAuth' => $this->DomainOutAuth(),
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
'Host' => $this->DomainOutHost(),
'Port' => $this->DomainOutPort(),
'Secure' => $this->DomainOutSecure(),
'Login' => $this->OutLogin(),
'Password' => $this->Password(),
'ProxyAuthUser' => $this->ProxyAuthUser(),
'ProxyAuthPassword' => $this->ProxyAuthPassword(),
'VerifySsl' => $this->DomainOutVerifySsl(!!$oConfig->Get('ssl', 'verify_certificate'))
);
$oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials));
$oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
if ($aSmtpCredentials['UseConnect'])
{
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
$aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']);
}
$oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
$oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials));
if ($aSmtpCredentials['UseAuth'])
{
$oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']);
$bLogin = true;
}
$oPlugins->RunHook('event.smtp-post-login', array($this, $aSmtpCredentials['UseAuth'], $bLogin, $aSmtpCredentials));
return $bLogin;
}
}

View file

@ -621,7 +621,7 @@ class Actions
if (null === $this->oDomainProvider)
{
$this->oDomainProvider = new \RainLoop\Providers\Domain(
$this->fabrica('domain'));
$this->fabrica('domain'), $this->Plugins());
}
return $this->oDomainProvider;
@ -833,23 +833,41 @@ class Actions
* @param string $sEmail
* @param string $sLogin
* @param string $sPassword
* @param bool $sSignMeToken = ''
* @param string $sSignMeToken = ''
* @param bool $bThrowProvideException = false
*
* @return \RainLoop\Account|null
*/
public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '')
public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '', $bThrowProvideException = false)
{
$oResult = null;
$oAccount = null;
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
{
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if ($oDomain instanceof \RainLoop\Domain && $oDomain->ValidateWhiteList($sEmail, $sLogin))
if ($oDomain instanceof \RainLoop\Domain)
{
$oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
{
$oAccount = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
$this->Plugins()->RunHook('filter.acount', array(&$oAccount));
if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Account))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
}
else if ($bThrowProvideException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountNotAllowed);
}
}
else if ($bThrowProvideException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
}
}
return $oResult;
return $oAccount;
}
/**
@ -866,36 +884,30 @@ class Actions
if (!empty($sToken))
{
$aAccountHash = \RainLoop\Utils::DecodeKeyValues($sToken);
if (!empty($aAccountHash[0]) && 'token' === $aAccountHash[0] && 8 === \count($aAccountHash) &&
// !empty($aAccountHash[4]) && \RainLoop\Utils::Fingerprint() === $aAccountHash[4] &&
!empty($aAccountHash[7]) && (!$bValidateShortToken || \RainLoop\Utils::GetShortToken() === $aAccountHash[7])
if (!empty($aAccountHash[0]) && 'token' === $aAccountHash[0] && // simple token validation
8 <= \count($aAccountHash) && // length checking
!empty($aAccountHash[7]) && // does short token exist
(!$bValidateShortToken || \RainLoop\Utils::GetShortToken() === $aAccountHash[7]) // check short token if needed
)
{
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
empty($aAccountHash[5]) ? '' : $aAccountHash[5]);
empty($aAccountHash[5]) ? '' : $aAccountHash[5], $bThrowExceptionOnFalse);
if ($oAccount instanceof \RainLoop\Account)
{
if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password
{
$oAccount->SetProxyAuthUser($aAccountHash[8]);
$oAccount->SetProxyAuthUser($aAccountHash[89]);
}
$this->Logger()->AddSecret($oAccount->Password());
$this->Logger()->AddSecret($oAccount->ProxyAuthPassword());
$oAccount->SetParentEmail($aAccountHash[6]);
$oResult = $oAccount;
}
else
{
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]), true);
if ($bThrowExceptionOnFalse)
{
if (!($oDomain instanceof \RainLoop\Domain))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
}
else if (!$oDomain->ValidateWhiteList($aAccountHash[1], $aAccountHash[2]))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountNotAllowed);
}
}
}
}
else if ($bThrowExceptionOnFalse)
{
@ -1361,7 +1373,7 @@ class Actions
/**
* @param \RainLoop\Account $oAccount
*/
public function AuthProcess($oAccount)
public function AuthToken($oAccount)
{
if ($oAccount instanceof \RainLoop\Account)
{
@ -1385,12 +1397,7 @@ class Actions
{
try
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure(),
$oAccount->Domain()->IncVerifySsl(!!$this->Config()->Get('ssl', 'verify_certificate')))
->Login($oAccount->IncLogin(), $oAccount->Password())
;
$oAccount->IncConnectAndLoginHelper($this->Plugins(), $this->MailClient(), $this->Config());
}
catch (\RainLoop\Exceptions\ClientException $oException)
{
@ -1481,6 +1488,8 @@ class Actions
if (false === \strpos($sEmail, '@') || 0 === \strlen($sPassword))
{
$this->loginErrorDelay();
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::InvalidInputArgument);
}
@ -1491,28 +1500,33 @@ class Actions
$this->Logger()->AddSecret($sPassword);
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken);
if (!($oAccount instanceof \RainLoop\Account))
$this->Plugins()->RunHook('event.login-pre-login-provide', array());
try
{
$this->loginErrorDelay();
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, true);
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if (!($oDomain instanceof \RainLoop\Domain))
if (!($oAccount instanceof \RainLoop\Account))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed);
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
else if (!$oDomain->ValidateWhiteList($sEmail, $sLogin))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountNotAllowed);
}
else
$this->Plugins()->RunHook('event.login-post-login-provide', array(&$oAccount));
if (!($oAccount instanceof \RainLoop\Account))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
}
catch (\Exception $oException)
{
$this->loginErrorDelay();
throw $oException;
}
// Two factor auth
if ($oAccount && $this->TwoFactorAuthProvider()->IsActive())
if ($this->TwoFactorAuthProvider()->IsActive())
{
$aData = $this->getTwoFactorInfo($oAccount->ParentEmailHelper());
if ($aData && isset($aData['IsSet'], $aData['Enable']) && !empty($aData['Secret']) && $aData['IsSet'] && $aData['Enable'])
@ -1526,6 +1540,7 @@ class Actions
if (empty($sAdditionalCode))
{
$this->Logger()->Write('TFA: Required Code for '.$oAccount->ParentEmailHelper().' account.');
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountTwoFactorAuthRequired);
}
else
@ -1553,6 +1568,7 @@ class Actions
if (!$bGood && !$this->TwoFactorAuthProvider()->VerifyCode($aData['Secret'], $sAdditionalCode))
{
$this->loginErrorDelay();
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountTwoFactorAuthError);
}
}
@ -1567,6 +1583,7 @@ class Actions
catch (\Exception $oException)
{
$this->loginErrorDelay();
throw $oException;
}
@ -1701,7 +1718,7 @@ class Actions
}
}
$this->AuthProcess($oAccount);
$this->AuthToken($oAccount);
if ($oAccount && 0 < \strlen($sLanguage))
{
@ -1983,7 +2000,7 @@ class Actions
$oAccountToChange = $this->GetAccountFromCustomToken($aAccounts[$sParentEmail], false, false);
if ($oAccountToChange)
{
$this->AuthProcess($oAccountToChange);
$this->AuthToken($oAccountToChange);
}
}
@ -4688,62 +4705,34 @@ class Actions
$oFrom = $oMessage->GetFrom();
$sFrom = $oFrom instanceof \MailSo\Mime\Email ? $oFrom->GetEmail() : '';
$sFrom = empty($sFrom) ? $oAccount->Email() : $sFrom;
$aSmtpCredentials = array(
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
'Host' => $oAccount->Domain()->OutHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
'Port' => $oAccount->Domain()->OutPort(),
'Secure' => $oAccount->Domain()->OutSecure(),
'UseAuth' => $oAccount->Domain()->OutAuth(),
'From' => empty($sFrom) ? $oAccount->Email() : $sFrom,
'Login' => $oAccount->OutLogin(),
'Password' => $oAccount->Password(),
'VerifySsl' => $oAccount->Domain()->OutVerifySsl(!!$this->Config()->Get('ssl', 'verify_certificate')),
'HiddenRcpt' => array()
);
$aHiddenRcpt = array();
$this->Plugins()->RunHook('filter.smtp-from', array($oAccount, $oMessage, &$sFrom));
$this->Plugins()->RunHook('filter.smtp-credentials', array($oAccount, &$aSmtpCredentials));
if (!$bAddHiddenRcpt)
if ($bAddHiddenRcpt)
{
$aSmtpCredentials['HiddenRcpt'] = array();
$this->Plugins()->RunHook('filter.smtp-hidden-rcpt', array($oAccount, $oMessage, &$aHiddenRcpt));
}
$bHookConnect = $bHookAuth = $bHookFrom = $bHookFrom = $bHookTo = $bHookData = $bHookLogoutAndDisconnect = false;
$this->Plugins()->RunHook('filter.smtp-connect', array($oAccount, $aSmtpCredentials,
&$oSmtpClient, $oMessage, &$oRcpt,
&$bHookConnect, &$bHookAuth, &$bHookFrom, &$bHookTo, &$bHookData, &$bHookLogoutAndDisconnect));
$bLoggined = $oAccount->OutConnectAndLoginHelper($this->Plugins(), $oSmtpClient, $this->Config());
if (!$bHookConnect)
if ($oSmtpClient->IsConnected())
{
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
$aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']);
}
if (!$bHookAuth)
{
if ($aSmtpCredentials['UseAuth'])
if (!empty($sFrom))
{
$oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']);
$oSmtpClient->MailFrom($sFrom);
}
}
if (!$bHookFrom)
{
$oSmtpClient->MailFrom($aSmtpCredentials['From']);
}
if (!$bHookTo)
{
$aRcpt =& $oRcpt->GetAsArray();
foreach ($aRcpt as /* @var $oEmail \MailSo\Mime\Email */ $oEmail)
{
$oSmtpClient->Rcpt($oEmail->GetEmail());
}
if (isset($aSmtpCredentials['HiddenRcpt']) && is_array($aSmtpCredentials['HiddenRcpt']))
if ($bAddHiddenRcpt && \is_array($aHiddenRcpt) && 0 < \count($aHiddenRcpt))
{
foreach ($aSmtpCredentials['HiddenRcpt'] as $sEmail)
foreach ($aHiddenRcpt as $sEmail)
{
if (\preg_match('/^[^@\s]+@[^@\s]+$/', $sEmail))
{
@ -4751,16 +4740,15 @@ class Actions
}
}
}
}
if (!$bHookData)
{
$oSmtpClient->DataWithStream($rMessageStream);
}
if (!$bHookLogoutAndDisconnect)
{
$oSmtpClient->LogoutAndDisconnect();
if ($bLoggined)
{
$oSmtpClient->Logout();
}
$oSmtpClient->Disconnect();
}
}
catch (\MailSo\Net\Exceptions\ConnectionException $oException)
@ -6672,12 +6660,7 @@ class Actions
try
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure(),
$oAccount->Domain()->IncVerifySsl(!!$this->Config()->Get('ssl', 'verify_certificate')))
->Login($oAccount->IncLogin(), $oAccount->Password(), !!$this->Config()->Get('labs', 'use_imap_auth_plain'))
;
$oAccount->IncConnectAndLoginHelper($this->Plugins(), $this->MailClient(), $this->Config());
}
catch (\MailSo\Net\Exceptions\ConnectionException $oException)
{

View file

@ -9,6 +9,11 @@ class Domain extends \RainLoop\Providers\AbstractProvider
*/
private $oDriver;
/**
* @var \RainLoop\Plugins\Manager
*/
private $oPlugins;
/**
* @var bool
*/
@ -19,9 +24,11 @@ class Domain extends \RainLoop\Providers\AbstractProvider
*
* @return void
*/
public function __construct(\RainLoop\Providers\Domain\DomainInterface $oDriver)
public function __construct(\RainLoop\Providers\Domain\DomainInterface $oDriver,
\RainLoop\Plugins\Manager $oPlugins)
{
$this->oDriver = $oDriver;
$this->oPlugins = $oPlugins;
$this->bAdmin = $this->oDriver instanceof \RainLoop\Providers\Domain\DomainAdminInterface;
}
@ -42,7 +49,13 @@ class Domain extends \RainLoop\Providers\AbstractProvider
*/
public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
{
return $this->oDriver->Load($sName, $bFindWithWildCard, $bCheckDisabled);
$oDomain = $this->oDriver->Load($sName, $bFindWithWildCard, $bCheckDisabled);
if ($oDomain instanceof \RainLoop\Domain)
{
$this->oPlugins->RunHook('filter.domain', array(&$oDomain));
}
return $oDomain;
}
/**

View file

@ -805,7 +805,7 @@ class ServiceActions
try
{
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account);
}
@ -843,7 +843,7 @@ class ServiceActions
try
{
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account);
}
catch (\Exception $oException)
@ -878,7 +878,7 @@ class ServiceActions
try
{
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account);
}
catch (\Exception $oException)
@ -994,7 +994,7 @@ class ServiceActions
if ($oAccountToLogin)
{
$this->oActions->AuthProcess($oAccountToLogin);
$this->oActions->AuthToken($oAccountToLogin);
}
}
@ -1042,7 +1042,7 @@ class ServiceActions
{
$this->oActions->CheckMailConnection($oAccount);
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$sAuthAccountHash = $this->oActions->GetSpecAuthToken();
}

View file

@ -348,7 +348,7 @@ class Social
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account)
{
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$iErrorCode = 0;
}
@ -495,7 +495,7 @@ class Social
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account)
{
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$iErrorCode = 0;
}
@ -671,7 +671,7 @@ class Social
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account)
{
$this->oActions->AuthProcess($oAccount);
$this->oActions->AuthToken($oAccount);
$iErrorCode = 0;
}