mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added mapping for sSmtpUser
This commit is contained in:
parent
5056ecf493
commit
2341dd9f62
1 changed files with 15 additions and 9 deletions
|
|
@ -4,9 +4,9 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'Custom Login Mapping',
|
NAME = 'Custom Login Mapping',
|
||||||
VERSION = '2.1',
|
VERSION = '2.2',
|
||||||
RELEASE = '2021-04-21',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.5.0',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
DESCRIPTION = 'Enables custom usernames by email address.';
|
DESCRIPTION = 'Enables custom usernames by email address.';
|
||||||
|
|
||||||
|
|
@ -17,12 +17,13 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sEmail
|
* @param string $sEmail
|
||||||
* @param string $sLogin
|
* @param string $sImapUser
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
|
* @param string $sSmtpUser
|
||||||
*
|
*
|
||||||
* @throws \RainLoop\Exceptions\ClientException
|
* @throws \RainLoop\Exceptions\ClientException
|
||||||
*/
|
*/
|
||||||
public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
|
public function FilterLoginCredentials(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
|
||||||
{
|
{
|
||||||
$sMapping = \trim($this->Config()->Get('plugin', 'mapping', ''));
|
$sMapping = \trim($this->Config()->Get('plugin', 'mapping', ''));
|
||||||
if (!empty($sMapping)) {
|
if (!empty($sMapping)) {
|
||||||
|
|
@ -32,8 +33,13 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$aData = \explode(':', $sLine, 2);
|
$aData = \explode(':', $sLine, 2);
|
||||||
if (\is_array($aData) && !empty($aData[0]) && isset($aData[1])) {
|
if (\is_array($aData) && !empty($aData[0]) && isset($aData[1])) {
|
||||||
$aData = \array_map('trim', $aData);
|
$aData = \array_map('trim', $aData);
|
||||||
if ($sEmail === $aData[0] && \strlen($aData[1])) {
|
if ($sEmail === $aData[0]) {
|
||||||
$sLogin = $aData[1];
|
if (\strlen($aData[1])) {
|
||||||
|
$sImapUser = $aData[1];
|
||||||
|
}
|
||||||
|
if (isset($aData[2]) && \strlen($aData[2])) {
|
||||||
|
$sSmtpUser = $aData[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +52,8 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
return array(
|
return array(
|
||||||
\RainLoop\Plugins\Property::NewInstance('mapping')->SetLabel('Mapping')
|
\RainLoop\Plugins\Property::NewInstance('mapping')->SetLabel('Mapping')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
||||||
->SetDescription('email:login mapping')
|
->SetDescription('email:imap-login:smtp-login mapping')
|
||||||
->SetDefaultValue("user@domain.com:user.bob\nadmin@domain.com:user.john")
|
->SetDefaultValue("user@domain.com:imapuser.bob:smtpuser.bob\nadmin@domain.com:imapuser.john")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue