Simple black list plugin fix

This commit is contained in:
RainLoop Team 2013-12-10 17:32:06 +04:00
parent 7f16fa87a3
commit e95a3c1f95

View file

@ -16,11 +16,11 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
*/ */
public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword) public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
{ {
if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, $sBlackList = \trim($this->Config()->Get('plugin', 'black_list', ''));
$this->Config()->Get('plugin', 'black_list', ''))) if (0 < \strlen($sBlackList) && \RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, $sBlackList))
{ {
$sExceptions = \trim($this->Config()->Get('plugin', 'exceptions', '')); $sExceptions = \trim($this->Config()->Get('plugin', 'exceptions', ''));
if (0 === strlen($sExceptions) || !\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, $sExceptions)) if (0 === \strlen($sExceptions) || !\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, $sExceptions))
{ {
throw new \RainLoop\Exceptions\ClientException( throw new \RainLoop\Exceptions\ClientException(
$this->Config()->Get('plugin', 'auth_error', true) ? $this->Config()->Get('plugin', 'auth_error', true) ?
@ -46,7 +46,7 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
\RainLoop\Plugins\Property::NewInstance('exceptions')->SetLabel('Exceptions') \RainLoop\Plugins\Property::NewInstance('exceptions')->SetLabel('Exceptions')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Exceptions for black list, space as delimiter, wildcard supported.') ->SetDescription('Exceptions for black list, space as delimiter, wildcard supported.')
->SetDefaultValue('demo@domain1.com test-*@domain2.com admin@*') ->SetDefaultValue('demo@domain1.com *@domain2.com admin@*')
); );
} }
} }