From d3ecfdc71edae09e16cbe123ccaf9c06e26406cc Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sat, 21 Sep 2024 20:15:14 +0200 Subject: [PATCH] Changes for #1706 --- plugins/README.md | 13 +++++++++++++ plugins/custom-login-mapping/index.php | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/README.md b/plugins/README.md index dcd129e09c..7e318c186d 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -124,11 +124,20 @@ $Plugin->addHook('hook.name', 'functionName'); params: string &$sEmail + Happens in resolveLoginCredentials($sEmail) BEFORE resolving domain name. + This is the pure text from the login screen (DoLogin) or the SSO feature (ServiceSso) received by LoginProcess(). + - DoLogin() -> LoginProcess() -> resolveLoginCredentials($sEmail) + - ServiceSso() -> LoginProcess() -> resolveLoginCredentials($sEmail) + So $sEmail can just have the value `test` without a domain. + ### login.credentials.step-2 params: string &$sEmail string &$sPassword + Happens in resolveLoginCredentials($sEmail) AFTER resolving domain name. + So $sEmail always has a domain (for example `test` is now `test@example.com`). + ### login.credentials params: string &$sEmail @@ -136,6 +145,10 @@ $Plugin->addHook('hook.name', 'functionName'); string &$sPassword string &$sSmtpUser + $sEmail is the domain imap->fixUsername() without shortening. + $sImapUser is the domain imap->fixUsername() for login into IMAP. + $sSmtpUser is the domain smtp->fixUsername() for login into SMTP. + ### login.success params: \RainLoop\Model\MainAccount $oAccount diff --git a/plugins/custom-login-mapping/index.php b/plugins/custom-login-mapping/index.php index 8105ef13e9..f282b0f605 100644 --- a/plugins/custom-login-mapping/index.php +++ b/plugins/custom-login-mapping/index.php @@ -4,8 +4,8 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin { const NAME = 'Custom Login Mapping', - VERSION = '2.2', - RELEASE = '2024-09-20', + VERSION = '2.3', + RELEASE = '2024-09-21', REQUIRED = '2.36.1', CATEGORY = 'Login', DESCRIPTION = 'Enables custom usernames by email address.'; @@ -30,7 +30,7 @@ public function FilterLoginCredentials(string &$sEmail, string &$sImapUser, stri $aLines = \explode("\n", \preg_replace('/[\r\n\t\s]+/', "\n", $sMapping)); foreach ($aLines as $sLine) { if (false !== \strpos($sLine, ':')) { - $aData = \explode(':', $sLine, 2); + $aData = \explode(':', $sLine, 3); if (\is_array($aData) && !empty($aData[0]) && isset($aData[1])) { $aData = \array_map('trim', $aData); if ($sEmail === $aData[0]) {