Skip to content

Commit

Permalink
Changes for #1706
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Sep 21, 2024
1 parent 56db749 commit d3ecfdc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,31 @@ $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 `[email protected]`).

### login.credentials
params:
string &$sEmail
string &$sImapUser
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
Expand Down
6 changes: 3 additions & 3 deletions plugins/custom-login-mapping/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand All @@ -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]) {
Expand Down

0 comments on commit d3ecfdc

Please sign in to comment.