mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03: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
|
|
@ -11,22 +11,22 @@ class HmailserverChangePasswordDriver implements \RainLoop\Providers\ChangePassw
|
|||
* @var string
|
||||
*/
|
||||
private $sPassword = '';
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var string
|
||||
*/
|
||||
private $aDomains = array();
|
||||
private $sAllowedEmails = '';
|
||||
|
||||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
*/
|
||||
private $oLogger = null;
|
||||
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1.1
|
||||
1.2
|
||||
|
|
@ -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('*')
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue