Change password plugins fixes

Small fixes
This commit is contained in:
RainLoop Team 2014-08-31 00:04:11 +04:00
parent 4cc1a0b0b7
commit c7108a74e0
13 changed files with 339 additions and 378 deletions

View file

@ -131,7 +131,7 @@ html.rgba.textshadow {
}
.tooltip-inner {
max-width: 400px;
max-width: 380px;
text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
padding: 5px 10px;
border-radius: 2px;

View file

@ -3,22 +3,18 @@
class ChangePasswordExampleDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
{
/**
* @var array
* @var string
*/
private $aDomains = array();
private $sAllowedEmails = '';
/**
* @param array $aDomains
* @param string $sAllowedEmails
*
* @return bool
* @return \ChangePasswordExampleDriver
*/
public function SetAllowedDomains($aDomains)
public function SetAllowedEmails($sAllowedEmails)
{
if (\is_array($aDomains) && 0 < \count($aDomains))
{
$this->aDomains = $aDomains;
}
$this->sAllowedEmails = $sAllowedEmails;
return $this;
}
@ -29,8 +25,8 @@ class ChangePasswordExampleDriver implements \RainLoop\Providers\ChangePassword\
*/
public function PasswordChangePossibility($oAccount)
{
return $oAccount && $oAccount->Domain() &&
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
return $oAccount && $oAccount->Email() &&
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
}
/**

View file

@ -1 +1 @@
1.0
1.1

View file

@ -20,15 +20,7 @@ class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
include_once __DIR__.'/ChangePasswordExampleDriver.php';
$oProvider = new ChangePasswordExampleDriver();
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
$this->Config()->Get('plugin', 'domains', ''))));
if (0 < \strlen($sDomains))
{
$aDomains = \explode(' ', $sDomains);
$oProvider->SetAllowedDomains($aDomains);
}
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
break;
}
@ -40,10 +32,10 @@ class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
public function configMapping()
{
return array(
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Allowed domains, space as delimiter')
->SetDefaultValue('domain1.com domain2.com')
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
->SetDefaultValue('*')
);
}
}

View file

@ -23,9 +23,9 @@ class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\C
private $sPassword = '';
/**
* @var array
* @var string
*/
private $aDomains = array();
private $sAllowedEmails = '';
/**
* @var \MailSo\Log\Logger
@ -39,7 +39,7 @@ class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\C
* @param string $sUser
* @param string $sPassword
*
* @return \CpanleChangePasswordDriver
* @return \CpanelChangePasswordDriver
*/
public function SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword)
{
@ -53,24 +53,20 @@ class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\C
}
/**
* @param array $aDomains
* @param string $sAllowedEmails
*
* @return \CpanleChangePasswordDriver
* @return \CpanelChangePasswordDriver
*/
public function SetAllowedDomains($aDomains)
public function SetAllowedEmails($sAllowedEmails)
{
if (\is_array($aDomains) && 0 < \count($aDomains))
{
$this->aDomains = $aDomains;
}
$this->sAllowedEmails = $sAllowedEmails;
return $this;
}
/**
* @param \MailSo\Log\Logger $oLogger
*
* @return \CpanleChangePasswordDriver
* @return \CpanelChangePasswordDriver
*/
public function SetLogger($oLogger)
{
@ -89,8 +85,8 @@ class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\C
*/
public function PasswordChangePossibility($oAccount)
{
return $oAccount && $oAccount->Domain() &&
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
return $oAccount && $oAccount->Email() &&
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
}
/**

View file

@ -1 +1 @@
1.1
1.2

View file

@ -30,15 +30,7 @@ class CpanelChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
$oProvider = new CpanelChangePasswordDriver();
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
$oProvider->SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword);
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
$this->Config()->Get('plugin', 'domains', ''))));
if (0 < \strlen($sDomains))
{
$aDomains = \explode(' ', $sDomains);
$oProvider->SetAllowedDomains($aDomains);
}
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
}
break;
@ -64,10 +56,10 @@ class CpanelChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('cPanel Password')
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
->SetDefaultValue(''),
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Allowed domains, space as delimiter')
->SetDefaultValue('domain1.com domain2.com')
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
->SetDefaultValue('*')
);
}
}

View file

@ -13,9 +13,9 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
private $sPassword = '';
/**
* @var array
* @var string
*/
private $aDomains = array();
private $sAllowedEmails = '';
/**
* @var \MailSo\Log\Logger
@ -26,7 +26,7 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
* @param string $sLogin
* @param string $sPassword
*
* @return \CpanleChangePasswordDriver
* @return \HmailserverChangePasswordDriver
*/
public function SetConfig($sLogin, $sPassword)
{
@ -37,24 +37,20 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
}
/**
* @param array $aDomains
* @param string $sAllowedEmails
*
* @return \CpanleChangePasswordDriver
* @return \HmailserverChangePasswordDriver
*/
public function SetAllowedDomains($aDomains)
public function SetAllowedEmails($sAllowedEmails)
{
if (\is_array($aDomains) && 0 < \count($aDomains))
{
$this->aDomains = $aDomains;
}
$this->sAllowedEmails = $sAllowedEmails;
return $this;
}
/**
* @param \MailSo\Log\Logger $oLogger
*
* @return \CpanleChangePasswordDriver
* @return \HmailserverChangePasswordDriver
*/
public function SetLogger($oLogger)
{
@ -73,8 +69,8 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
*/
public function PasswordChangePossibility($oAccount)
{
return $oAccount && $oAccount->Domain() &&
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
return $oAccount && $oAccount->Email() &&
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
}
/**

View file

@ -1 +1 @@
1.1
1.2

View file

@ -40,15 +40,7 @@ class HmailserverChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
$oProvider = new HmailserverChangePasswordDriver();
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
$oProvider->SetConfig($sLogin, $sPassword);
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
$this->Config()->Get('plugin', 'domains', ''))));
if (0 < \strlen($sDomains))
{
$aDomains = \explode(' ', $sDomains);
$oProvider->SetAllowedDomains($aDomains);
}
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
}
break;
@ -66,10 +58,10 @@ class HmailserverChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('HmailServer Admin Password')
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
->SetDefaultValue(''),
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Allowed domains, space as delimiter')
->SetDefaultValue('domain1.com domain2.com')
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
->SetDefaultValue('*')
);
}
}

View file

@ -238,11 +238,6 @@ abstract class NetClient
{
@\stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
}
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_blocking'))
{
@\stream_set_blocking($this->rConnect, 1);
}
}
}
@ -413,6 +408,8 @@ abstract class NetClient
}
else
{
// $this->writeLog('Stream Meta: '.
// \print_r($aSocketStatus, true), \MailSo\Log\Enumerations\Type::ERROR);
$this->writeLogException(
new Exceptions\SocketReadException(),
\MailSo\Log\Enumerations\Type::ERROR, true);

View file

@ -6295,7 +6295,7 @@ html.rgba.textshadow .btn.btn-primary {
}
.tooltip .tooltip-inner {
padding: 5px 10px;
max-width: 400px;
max-width: 380px;
border-radius: 2px;
text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

File diff suppressed because one or more lines are too long