This commit is contained in:
the-djmaze 2023-02-02 13:26:23 +01:00
parent 565ef41eba
commit 78938caaf3
10 changed files with 85 additions and 45 deletions

View file

@ -25,19 +25,14 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
{
$sMapping = \trim($this->Config()->Get('plugin', 'mapping', ''));
if (!empty($sMapping))
{
if (!empty($sMapping)) {
$aLines = \explode("\n", \preg_replace('/[\r\n\t\s]+/', "\n", $sMapping));
foreach ($aLines as $sLine)
{
if (false !== strpos($sLine, ':'))
{
foreach ($aLines as $sLine) {
if (false !== \strpos($sLine, ':')) {
$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);
if ($sEmail === $aData[0] && 0 < strlen($aData[1]))
{
if ($sEmail === $aData[0] && \strlen($aData[1])) {
$sLogin = $aData[1];
}
}
@ -46,9 +41,6 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
}
}
/**
* @return array
*/
protected function configMapping() : array
{
return array(

View file

@ -4,8 +4,8 @@ class LdapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Contacts suggestions (LDAP)',
VERSION = '2.11',
RELEASE = '2023-01-27',
VERSION = '2.12',
RELEASE = '2023-01-31',
REQUIRED = '2.23.0',
CATEGORY = 'Contacts',
DESCRIPTION = 'Get contacts suggestions from LDAP.';