mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
Change password plugins fixes
Small fixes
This commit is contained in:
parent
4cc1a0b0b7
commit
c7108a74e0
13 changed files with 339 additions and 378 deletions
|
@ -131,7 +131,7 @@ html.rgba.textshadow {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltip-inner {
|
.tooltip-inner {
|
||||||
max-width: 400px;
|
max-width: 380px;
|
||||||
text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
|
|
@ -1,51 +1,47 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ChangePasswordExampleDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
|
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->sAllowedEmails = $sAllowedEmails;
|
||||||
{
|
return $this;
|
||||||
$this->aDomains = $aDomains;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
return $this;
|
* @param \RainLoop\Account $oAccount
|
||||||
}
|
*
|
||||||
|
* @return bool
|
||||||
/**
|
*/
|
||||||
* @param \RainLoop\Account $oAccount
|
public function PasswordChangePossibility($oAccount)
|
||||||
*
|
{
|
||||||
* @return bool
|
return $oAccount && $oAccount->Email() &&
|
||||||
*/
|
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
|
||||||
public function PasswordChangePossibility($oAccount)
|
}
|
||||||
{
|
|
||||||
return $oAccount && $oAccount->Domain() &&
|
/**
|
||||||
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
|
* @param \RainLoop\Account $oAccount
|
||||||
}
|
* @param string $sPrevPassword
|
||||||
|
* @param string $sNewPassword
|
||||||
/**
|
*
|
||||||
* @param \RainLoop\Account $oAccount
|
* @return bool
|
||||||
* @param string $sPrevPassword
|
*/
|
||||||
* @param string $sNewPassword
|
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
|
||||||
*
|
{
|
||||||
* @return bool
|
$bResult = false;
|
||||||
*/
|
|
||||||
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
|
// TODO
|
||||||
{
|
|
||||||
$bResult = false;
|
return $bResult;
|
||||||
|
}
|
||||||
// TODO
|
|
||||||
|
|
||||||
return $bResult;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1 +1 @@
|
||||||
1.0
|
1.1
|
|
@ -1,49 +1,41 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
$this->addHook('main.fabrica', 'MainFabrica');
|
$this->addHook('main.fabrica', 'MainFabrica');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $oProvider
|
* @param mixed $oProvider
|
||||||
*/
|
*/
|
||||||
public function MainFabrica($sName, &$oProvider)
|
public function MainFabrica($sName, &$oProvider)
|
||||||
{
|
{
|
||||||
switch ($sName)
|
switch ($sName)
|
||||||
{
|
{
|
||||||
case 'change-password':
|
case 'change-password':
|
||||||
|
|
||||||
include_once __DIR__.'/ChangePasswordExampleDriver.php';
|
include_once __DIR__.'/ChangePasswordExampleDriver.php';
|
||||||
|
|
||||||
$oProvider = new ChangePasswordExampleDriver();
|
$oProvider = new ChangePasswordExampleDriver();
|
||||||
|
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
|
||||||
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
|
|
||||||
$this->Config()->Get('plugin', 'domains', ''))));
|
break;
|
||||||
|
}
|
||||||
if (0 < \strlen($sDomains))
|
}
|
||||||
{
|
|
||||||
$aDomains = \explode(' ', $sDomains);
|
/**
|
||||||
$oProvider->SetAllowedDomains($aDomains);
|
* @return array
|
||||||
}
|
*/
|
||||||
|
public function configMapping()
|
||||||
break;
|
{
|
||||||
}
|
return array(
|
||||||
}
|
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
|
||||||
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
||||||
/**
|
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
|
||||||
* @return array
|
->SetDefaultValue('*')
|
||||||
*/
|
);
|
||||||
public function configMapping()
|
}
|
||||||
{
|
|
||||||
return array(
|
|
||||||
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
|
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
|
||||||
->SetDescription('Allowed domains, space as delimiter')
|
|
||||||
->SetDefaultValue('domain1.com domain2.com')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,159 +1,155 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
|
class CpanelChangePasswordDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sHost = '';
|
private $sHost = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $iPost = 2087;
|
private $iPost = 2087;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sUser = '';
|
private $sUser = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sPassword = '';
|
private $sPassword = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $aDomains = array();
|
private $sAllowedEmails = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \MailSo\Log\Logger
|
* @var \MailSo\Log\Logger
|
||||||
*/
|
*/
|
||||||
private $oLogger = null;
|
private $oLogger = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHost
|
* @param string $sHost
|
||||||
* @param int $iPost
|
* @param int $iPost
|
||||||
* @param bool $sSsl
|
* @param bool $sSsl
|
||||||
* @param string $sUser
|
* @param string $sUser
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
*
|
*
|
||||||
* @return \CpanleChangePasswordDriver
|
* @return \CpanelChangePasswordDriver
|
||||||
*/
|
*/
|
||||||
public function SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword)
|
public function SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword)
|
||||||
{
|
{
|
||||||
$this->sHost = $sHost;
|
$this->sHost = $sHost;
|
||||||
$this->iPost = $iPost;
|
$this->iPost = $iPost;
|
||||||
$this->sSsl = $sSsl;
|
$this->sSsl = $sSsl;
|
||||||
$this->sUser = $sUser;
|
$this->sUser = $sUser;
|
||||||
$this->sPassword = $sPassword;
|
$this->sPassword = $sPassword;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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->sAllowedEmails = $sAllowedEmails;
|
||||||
{
|
return $this;
|
||||||
$this->aDomains = $aDomains;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
return $this;
|
* @param \MailSo\Log\Logger $oLogger
|
||||||
}
|
*
|
||||||
|
* @return \CpanelChangePasswordDriver
|
||||||
/**
|
*/
|
||||||
* @param \MailSo\Log\Logger $oLogger
|
public function SetLogger($oLogger)
|
||||||
*
|
{
|
||||||
* @return \CpanleChangePasswordDriver
|
if ($oLogger instanceof \MailSo\Log\Logger)
|
||||||
*/
|
{
|
||||||
public function SetLogger($oLogger)
|
$this->oLogger = $oLogger;
|
||||||
{
|
}
|
||||||
if ($oLogger instanceof \MailSo\Log\Logger)
|
|
||||||
{
|
return $this;
|
||||||
$this->oLogger = $oLogger;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
return $this;
|
* @param \RainLoop\Account $oAccount
|
||||||
}
|
*
|
||||||
|
* @return bool
|
||||||
/**
|
*/
|
||||||
* @param \RainLoop\Account $oAccount
|
public function PasswordChangePossibility($oAccount)
|
||||||
*
|
{
|
||||||
* @return bool
|
return $oAccount && $oAccount->Email() &&
|
||||||
*/
|
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
|
||||||
public function PasswordChangePossibility($oAccount)
|
}
|
||||||
{
|
|
||||||
return $oAccount && $oAccount->Domain() &&
|
/**
|
||||||
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
|
* @param \RainLoop\Account $oAccount
|
||||||
}
|
* @param string $sPrevPassword
|
||||||
|
* @param string $sNewPassword
|
||||||
/**
|
*
|
||||||
* @param \RainLoop\Account $oAccount
|
* @return bool
|
||||||
* @param string $sPrevPassword
|
*/
|
||||||
* @param string $sNewPassword
|
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
|
||||||
*
|
{
|
||||||
* @return bool
|
if ($this->oLogger)
|
||||||
*/
|
{
|
||||||
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
|
$this->oLogger->Write('Try to change password for '.$oAccount->Email());
|
||||||
{
|
}
|
||||||
if ($this->oLogger)
|
|
||||||
{
|
include_once __DIR__.'/xmlapi.php';
|
||||||
$this->oLogger->Write('Try to change password for '.$oAccount->Email());
|
|
||||||
}
|
$bResult = false;
|
||||||
|
if (!empty($this->sHost) && 0 < $this->iPost &&
|
||||||
include_once __DIR__.'/xmlapi.php';
|
0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) &&
|
||||||
|
$oAccount && \class_exists('xmlapi'))
|
||||||
$bResult = false;
|
{
|
||||||
if (!empty($this->sHost) && 0 < $this->iPost &&
|
try
|
||||||
0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) &&
|
{
|
||||||
$oAccount && \class_exists('xmlapi'))
|
$oXmlApi = new \xmlapi($this->sHost);
|
||||||
{
|
$oXmlApi->set_port($this->iPost);
|
||||||
try
|
$oXmlApi->set_protocol($this->sSsl ? 'https' : 'http');
|
||||||
{
|
$oXmlApi->set_debug(false);
|
||||||
$oXmlApi = new \xmlapi($this->sHost);
|
$oXmlApi->set_output('json');
|
||||||
$oXmlApi->set_port($this->iPost);
|
$oXmlApi->set_http_client('curl');
|
||||||
$oXmlApi->set_protocol($this->sSsl ? 'https' : 'http');
|
$oXmlApi->password_auth($this->sUser, $this->sPassword);
|
||||||
$oXmlApi->set_debug(false);
|
|
||||||
$oXmlApi->set_output('json');
|
$sEmail = $oAccount->Email();
|
||||||
$oXmlApi->set_http_client('curl');
|
|
||||||
$oXmlApi->password_auth($this->sUser, $this->sPassword);
|
$aArgs = array(
|
||||||
|
'email' => \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail),
|
||||||
$sEmail = $oAccount->Email();
|
'domain' => \MailSo\Base\Utils::GetDomainFromEmail($sEmail),
|
||||||
|
'password' => $sNewPassword
|
||||||
$aArgs = array(
|
);
|
||||||
'email' => \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail),
|
|
||||||
'domain' => \MailSo\Base\Utils::GetDomainFromEmail($sEmail),
|
$sResult = $oXmlApi->api2_query($this->sUser, 'Email', 'passwdpop', $aArgs);
|
||||||
'password' => $sNewPassword
|
if ($sResult)
|
||||||
);
|
{
|
||||||
|
$aResult = @\json_decode($sResult, true);
|
||||||
$sResult = $oXmlApi->api2_query($this->sUser, 'Email', 'passwdpop', $aArgs);
|
$bResult = isset($aResult['cpanelresult']['data'][0]['result']) &&
|
||||||
if ($sResult)
|
!!$aResult['cpanelresult']['data'][0]['result'];
|
||||||
{
|
}
|
||||||
$aResult = @\json_decode($sResult, true);
|
|
||||||
$bResult = isset($aResult['cpanelresult']['data'][0]['result']) &&
|
if (!$bResult && $this->oLogger)
|
||||||
!!$aResult['cpanelresult']['data'][0]['result'];
|
{
|
||||||
}
|
$this->oLogger->Write('CPANEL: '.$sResult, \MailSo\Log\Enumerations\Type::ERROR);
|
||||||
|
}
|
||||||
if (!$bResult && $this->oLogger)
|
}
|
||||||
{
|
catch (\Exception $oException)
|
||||||
$this->oLogger->Write('CPANEL: '.$sResult, \MailSo\Log\Enumerations\Type::ERROR);
|
{
|
||||||
}
|
if ($this->oLogger)
|
||||||
}
|
{
|
||||||
catch (\Exception $oException)
|
$this->oLogger->WriteException($oException);
|
||||||
{
|
}
|
||||||
if ($this->oLogger)
|
}
|
||||||
{
|
}
|
||||||
$this->oLogger->WriteException($oException);
|
|
||||||
}
|
return $bResult;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $bResult;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1 +1 @@
|
||||||
1.1
|
1.2
|
|
@ -1,73 +1,65 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class CpanelChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
class CpanelChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
$this->addHook('main.fabrica', 'MainFabrica');
|
$this->addHook('main.fabrica', 'MainFabrica');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $oProvider
|
* @param mixed $oProvider
|
||||||
*/
|
*/
|
||||||
public function MainFabrica($sName, &$oProvider)
|
public function MainFabrica($sName, &$oProvider)
|
||||||
{
|
{
|
||||||
switch ($sName)
|
switch ($sName)
|
||||||
{
|
{
|
||||||
case 'change-password':
|
case 'change-password':
|
||||||
|
|
||||||
$sHost = \trim($this->Config()->Get('plugin', 'host', ''));
|
$sHost = \trim($this->Config()->Get('plugin', 'host', ''));
|
||||||
$iPost = (int) $this->Config()->Get('plugin', 'port', 2087);
|
$iPost = (int) $this->Config()->Get('plugin', 'port', 2087);
|
||||||
$sUser = (string) $this->Config()->Get('plugin', 'user', '');
|
$sUser = (string) $this->Config()->Get('plugin', 'user', '');
|
||||||
$sPassword = (string) $this->Config()->Get('plugin', 'password', '');
|
$sPassword = (string) $this->Config()->Get('plugin', 'password', '');
|
||||||
$sSsl = (bool) $this->Config()->Get('plugin', 'ssl', false);
|
$sSsl = (bool) $this->Config()->Get('plugin', 'ssl', false);
|
||||||
|
|
||||||
if (!empty($sHost) && 0 < $iPost && 0 < \strlen($sUser) && 0 < \strlen($sPassword))
|
if (!empty($sHost) && 0 < $iPost && 0 < \strlen($sUser) && 0 < \strlen($sPassword))
|
||||||
{
|
{
|
||||||
include_once __DIR__.'/CpanelChangePasswordDriver.php';
|
include_once __DIR__.'/CpanelChangePasswordDriver.php';
|
||||||
|
|
||||||
$oProvider = new CpanelChangePasswordDriver();
|
$oProvider = new CpanelChangePasswordDriver();
|
||||||
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
|
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
|
||||||
$oProvider->SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword);
|
$oProvider->SetConfig($sHost, $iPost, $sSsl, $sUser, $sPassword);
|
||||||
|
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
|
||||||
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
|
}
|
||||||
$this->Config()->Get('plugin', 'domains', ''))));
|
|
||||||
|
break;
|
||||||
if (0 < \strlen($sDomains))
|
}
|
||||||
{
|
}
|
||||||
$aDomains = \explode(' ', $sDomains);
|
|
||||||
$oProvider->SetAllowedDomains($aDomains);
|
/**
|
||||||
}
|
* @return array
|
||||||
}
|
*/
|
||||||
|
public function configMapping()
|
||||||
break;
|
{
|
||||||
}
|
return array(
|
||||||
}
|
\RainLoop\Plugins\Property::NewInstance('host')->SetLabel('cPanel Host')
|
||||||
|
->SetDefaultValue(''),
|
||||||
/**
|
\RainLoop\Plugins\Property::NewInstance('port')->SetLabel('cPanel Port')
|
||||||
* @return array
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
|
||||||
*/
|
->SetDefaultValue(2087),
|
||||||
public function configMapping()
|
\RainLoop\Plugins\Property::NewInstance('ssl')->SetLabel('Use SSL')
|
||||||
{
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||||
return array(
|
->SetDefaultValue(false),
|
||||||
\RainLoop\Plugins\Property::NewInstance('host')->SetLabel('cPanel Host')
|
\RainLoop\Plugins\Property::NewInstance('user')->SetLabel('cPanel User')
|
||||||
->SetDefaultValue(''),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('port')->SetLabel('cPanel Port')
|
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('cPanel Password')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
||||||
->SetDefaultValue(2087),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('ssl')->SetLabel('Use SSL')
|
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
||||||
->SetDefaultValue(false),
|
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
|
||||||
\RainLoop\Plugins\Property::NewInstance('user')->SetLabel('cPanel User')
|
->SetDefaultValue('*')
|
||||||
->SetDefaultValue(''),
|
);
|
||||||
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('cPanel Password')
|
}
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
|
||||||
->SetDefaultValue(''),
|
|
||||||
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
|
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
|
||||||
->SetDescription('Allowed domains, space as delimiter')
|
|
||||||
->SetDefaultValue('domain1.com domain2.com')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,22 +11,22 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sPassword = '';
|
private $sPassword = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $aDomains = array();
|
private $sAllowedEmails = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \MailSo\Log\Logger
|
* @var \MailSo\Log\Logger
|
||||||
*/
|
*/
|
||||||
private $oLogger = null;
|
private $oLogger = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sLogin
|
* @param string $sLogin
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
*
|
*
|
||||||
* @return \CpanleChangePasswordDriver
|
* @return \HmailserverChangePasswordDriver
|
||||||
*/
|
*/
|
||||||
public function SetConfig($sLogin, $sPassword)
|
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->sAllowedEmails = $sAllowedEmails;
|
||||||
{
|
|
||||||
$this->aDomains = $aDomains;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \MailSo\Log\Logger $oLogger
|
* @param \MailSo\Log\Logger $oLogger
|
||||||
*
|
*
|
||||||
* @return \CpanleChangePasswordDriver
|
* @return \HmailserverChangePasswordDriver
|
||||||
*/
|
*/
|
||||||
public function SetLogger($oLogger)
|
public function SetLogger($oLogger)
|
||||||
{
|
{
|
||||||
|
@ -73,8 +69,8 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
|
||||||
*/
|
*/
|
||||||
public function PasswordChangePossibility($oAccount)
|
public function PasswordChangePossibility($oAccount)
|
||||||
{
|
{
|
||||||
return $oAccount && $oAccount->Domain() &&
|
return $oAccount && $oAccount->Email() &&
|
||||||
\in_array(\strtolower($oAccount->Domain()->Name()), $this->aDomains);
|
\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.1
|
1.2
|
|
@ -40,15 +40,7 @@ class HmailserverChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$oProvider = new HmailserverChangePasswordDriver();
|
$oProvider = new HmailserverChangePasswordDriver();
|
||||||
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
|
$oProvider->SetLogger($this->Manager()->Actions()->Logger());
|
||||||
$oProvider->SetConfig($sLogin, $sPassword);
|
$oProvider->SetConfig($sLogin, $sPassword);
|
||||||
|
$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
|
||||||
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ',
|
|
||||||
$this->Config()->Get('plugin', 'domains', ''))));
|
|
||||||
|
|
||||||
if (0 < \strlen($sDomains))
|
|
||||||
{
|
|
||||||
$aDomains = \explode(' ', $sDomains);
|
|
||||||
$oProvider->SetAllowedDomains($aDomains);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -66,10 +58,10 @@ class HmailserverChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('HmailServer Admin Password')
|
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('HmailServer Admin Password')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
||||||
->SetDefaultValue(''),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains')
|
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
||||||
->SetDescription('Allowed domains, space as delimiter')
|
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
|
||||||
->SetDefaultValue('domain1.com domain2.com')
|
->SetDefaultValue('*')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -82,7 +82,7 @@ abstract class NetClient
|
||||||
$this->bUnreadBuffer = false;
|
$this->bUnreadBuffer = false;
|
||||||
$this->bRunningCallback = false;
|
$this->bRunningCallback = false;
|
||||||
$this->oLogger = null;
|
$this->oLogger = null;
|
||||||
|
|
||||||
$this->__AUTOLOGOUT__ = true;
|
$this->__AUTOLOGOUT__ = true;
|
||||||
|
|
||||||
$this->sResponseBuffer = '';
|
$this->sResponseBuffer = '';
|
||||||
|
@ -238,11 +238,6 @@ abstract class NetClient
|
||||||
{
|
{
|
||||||
@\stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
|
@\stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_blocking'))
|
|
||||||
{
|
|
||||||
@\stream_set_blocking($this->rConnect, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +334,7 @@ abstract class NetClient
|
||||||
{
|
{
|
||||||
$bFake = false;
|
$bFake = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bFake)
|
if ($bFake)
|
||||||
{
|
{
|
||||||
$sFakeRaw .= "\r\n";
|
$sFakeRaw .= "\r\n";
|
||||||
|
@ -413,6 +408,8 @@ abstract class NetClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// $this->writeLog('Stream Meta: '.
|
||||||
|
// \print_r($aSocketStatus, true), \MailSo\Log\Enumerations\Type::ERROR);
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new Exceptions\SocketReadException(),
|
new Exceptions\SocketReadException(),
|
||||||
\MailSo\Log\Enumerations\Type::ERROR, true);
|
\MailSo\Log\Enumerations\Type::ERROR, true);
|
||||||
|
|
|
@ -637,7 +637,7 @@
|
||||||
filter: Alpha(Opacity=30);
|
filter: Alpha(Opacity=30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
|
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
|
||||||
|
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
|
@ -1150,7 +1150,7 @@ table {
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
|
@ -1522,7 +1522,7 @@ table {
|
||||||
.icon-resize-out:before {
|
.icon-resize-out:before {
|
||||||
content: "\e06d";
|
content: "\e06d";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** initial setup **/
|
/** initial setup **/
|
||||||
.nano {
|
.nano {
|
||||||
/*
|
/*
|
||||||
|
@ -1638,7 +1638,7 @@ table {
|
||||||
.nano > .pane2.active > .slider2 {
|
.nano > .pane2.active > .slider2 {
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Magnific Popup CSS */
|
/* Magnific Popup CSS */
|
||||||
.mfp-bg {
|
.mfp-bg {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -2094,7 +2094,7 @@ img.mfp-img {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* overlay at start */
|
/* overlay at start */
|
||||||
.mfp-fade.mfp-bg {
|
.mfp-fade.mfp-bg {
|
||||||
|
@ -2135,7 +2135,7 @@ img.mfp-img {
|
||||||
-ms-transform: translateX(50px);
|
-ms-transform: translateX(50px);
|
||||||
transform: translateX(50px);
|
transform: translateX(50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.simple-pace {
|
.simple-pace {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
|
@ -2210,7 +2210,7 @@ img.mfp-img {
|
||||||
transform: translate(-32px, 0);
|
transform: translate(-32px, 0);
|
||||||
transform: translate(-32px, 0);
|
transform: translate(-32px, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.inputosaurus-container {
|
.inputosaurus-container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 5px 0 0;
|
margin: 0 5px 0 0;
|
||||||
|
@ -2275,7 +2275,7 @@ img.mfp-img {
|
||||||
.inputosaurus-input-hidden {
|
.inputosaurus-input-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flag-wrapper {
|
.flag-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
|
@ -2397,7 +2397,7 @@ img.mfp-img {
|
||||||
.flag.flag-zh-hk {
|
.flag.flag-zh-hk {
|
||||||
background-position: -208px -22px;
|
background-position: -208px -22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||||
.clearfix {
|
.clearfix {
|
||||||
*zoom: 1;
|
*zoom: 1;
|
||||||
|
@ -6295,7 +6295,7 @@ html.rgba.textshadow .btn.btn-primary {
|
||||||
}
|
}
|
||||||
.tooltip .tooltip-inner {
|
.tooltip .tooltip-inner {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
max-width: 400px;
|
max-width: 380px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue