This commit is contained in:
the-djmaze 2024-09-21 20:15:14 +02:00
parent 56db74986f
commit d3ecfdc71e
2 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -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 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
$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]) {