mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-29 19:12:26 +08:00
52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
class PoppassdChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|
{
|
|
public function Init()
|
|
{
|
|
$this->addHook('main.fabrica', 'MainFabrica');
|
|
}
|
|
|
|
/**
|
|
* @param string $sName
|
|
* @param mixed $oProvider
|
|
*/
|
|
public function MainFabrica($sName, &$oProvider)
|
|
{
|
|
switch ($sName)
|
|
{
|
|
case 'change-password':
|
|
|
|
include_once __DIR__.'/ChangePasswordPoppassdDriver.php';
|
|
|
|
$oProvider = new ChangePasswordPoppassdDriver();
|
|
|
|
$oProvider
|
|
->SetHost($this->Config()->Get('plugin', 'host', ''))
|
|
->SetPort($this->Config()->Get('plugin', 'port', ''))
|
|
->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))))
|
|
->SetLogger($this->Manager()->Actions()->Logger())
|
|
;
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function configMapping()
|
|
{
|
|
return array(
|
|
\RainLoop\Plugins\Property::NewInstance('host')->SetLabel('POPPASSD Host')
|
|
->SetDefaultValue('127.0.0.1'),
|
|
\RainLoop\Plugins\Property::NewInstance('port')->SetLabel('POPPASSD Port')
|
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
|
|
->SetDefaultValue(106),
|
|
\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')
|
|
->SetDefaultValue('*')
|
|
);
|
|
}
|
|
}
|