mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
resolved problems arised from changes in v2.36
This commit is contained in:
parent
e9f2b71574
commit
1ec4930dfa
2 changed files with 29 additions and 13 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
use RainLoop\Enumerations\Capa;
|
use RainLoop\Enumerations\Capa;
|
||||||
use MailSo\Log\Logger;
|
use MailSo\Log\Logger;
|
||||||
use RainLoop\Actions;
|
use RainLoop\Actions;
|
||||||
|
use RainLoop\Model\AdditionalAccount;
|
||||||
use RainLoop\Model\MainAccount;
|
use RainLoop\Model\MainAccount;
|
||||||
|
|
||||||
class LdapMailAccounts
|
class LdapMailAccounts
|
||||||
|
|
@ -50,14 +51,13 @@ class LdapMailAccounts
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*
|
*
|
||||||
* AOverwrite the MainAccount mail address by looking up the new one in the ldap directory
|
* Overwrite the MainAccount mail address by looking up the new one in the ldap directory
|
||||||
*
|
*
|
||||||
* The ldap search string has to be configured in the plugin configuration of the extension (in the SnappyMail Admin Panel)
|
* The ldap search string has to be configured in the plugin configuration of the extension (in the SnappyMail Admin Panel)
|
||||||
*
|
*
|
||||||
* @param string &$sEmail
|
* @param string &$sEmail
|
||||||
* @param string &$sLogin
|
|
||||||
*/
|
*/
|
||||||
public function overwriteEmail(&$sEmail, &$sLogin)
|
public function overwriteEmail(&$sEmail)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->EnsureBound();
|
$this->EnsureBound();
|
||||||
|
|
@ -105,10 +105,12 @@ class LdapMailAccounts
|
||||||
|
|
||||||
foreach($mailAddressResults as $mailAddressResult)
|
foreach($mailAddressResults as $mailAddressResult)
|
||||||
{
|
{
|
||||||
|
$this->logger->Write("AAAAAAA: $mailAddressResult->username , $username , $mailAddressResult->mailMainAccount , $sEmail", \LOG_NOTICE, self::LOG_KEY);
|
||||||
if($mailAddressResult->username === $username) {
|
if($mailAddressResult->username === $username) {
|
||||||
//$sLogin is already set to be the same as $sEmail by function "resolveLoginCredentials" in /RainLoop/Actions/UserAuth.php
|
//$sImapUser and $sSmtpUser are already set to be the same as $sEmail by function "resolveLoginCredentials" in /RainLoop/Actions/UserAuth.php
|
||||||
//that called this hook, so we just have to overwrite the mail address
|
//that called this hook, so we just have to overwrite the mail address
|
||||||
$sEmail = $mailAddressResult->mailMainAccount;
|
$sEmail = $mailAddressResult->mailMainAccount;
|
||||||
|
$this->logger->Write("BBBBBBB: $mailAddressResult->username , $username , $mailAddressResult->mailMainAccount , $sEmail", \LOG_NOTICE, self::LOG_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,9 +133,9 @@ class LdapMailAccounts
|
||||||
return false; // exceptions are only thrown from the handle error function that does logging already
|
return false; // exceptions are only thrown from the handle error function that does logging already
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to get account information. IncLogin() returns the username of the user
|
// Try to get account information. ImapUser() returns the username of the user
|
||||||
// and removes the domainname if this was configured inside the domain config.
|
// and removes the domainname if this was configured inside the domain config.
|
||||||
$username = @ldap_escape($oAccount->IncLogin(), "", LDAP_ESCAPE_FILTER);
|
$username = @ldap_escape($oAccount->ImapUser(), "", LDAP_ESCAPE_FILTER);
|
||||||
|
|
||||||
$searchString = $this->config->search_string;
|
$searchString = $this->config->search_string;
|
||||||
|
|
||||||
|
|
@ -210,7 +212,19 @@ class LdapMailAccounts
|
||||||
//if this fails the user will see the new mail addresses but will be asked for the correct password
|
//if this fails the user will see the new mail addresses but will be asked for the correct password
|
||||||
$sPass = new \SnappyMail\SensitiveString($oAccount->IncPassword());
|
$sPass = new \SnappyMail\SensitiveString($oAccount->IncPassword());
|
||||||
//After creating the accounts here $sUsername is used as username to login to the IMAP server (see Account.php)
|
//After creating the accounts here $sUsername is used as username to login to the IMAP server (see Account.php)
|
||||||
$oNewAccount = RainLoop\Model\AdditionalAccount::NewInstanceFromCredentials($oActions, $sEmail, $sUsername, $sPass);
|
//$oNewAccount = RainLoop\Model\AdditionalAccount::NewInstanceFromCredentials($oActions, $sEmail, $sUsername, $sPass);
|
||||||
|
|
||||||
|
$oDomain = $oActions->DomainProvider()->Load($sDomain, false);
|
||||||
|
|
||||||
|
$oNewAccount = new AdditionalAccount;
|
||||||
|
$oNewAccount->setCredentials(
|
||||||
|
$oDomain,
|
||||||
|
$sEmail,
|
||||||
|
$sUsername,
|
||||||
|
$sPass,
|
||||||
|
$sUsername,
|
||||||
|
$sPass
|
||||||
|
);
|
||||||
|
|
||||||
$aAccounts[$sEmail] = $oNewAccount->asTokenArray($oAccount);
|
$aAccounts[$sEmail] = $oNewAccount->asTokenArray($oAccount);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,13 @@ class LdapMailAccountsPlugin extends AbstractPlugin
|
||||||
* Overwrite the MainAccount mail address by looking up the new one in the ldap directory
|
* Overwrite the MainAccount mail address by looking up the new one in the ldap directory
|
||||||
*
|
*
|
||||||
* @param string &$sEmail
|
* @param string &$sEmail
|
||||||
* @param string &$sLogin
|
* @param string &$sImapUser
|
||||||
|
* @param string &$sPassword
|
||||||
|
* @param string &$sSmtpUser
|
||||||
*/
|
*/
|
||||||
public function overwriteMainAccountEmail(&$sEmail, &$sLogin)
|
public function overwriteMainAccountEmail(&$sEmail, &$sImapUser, &$sPassword, &$sSmtpUser)
|
||||||
{
|
{
|
||||||
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sLogin email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
|
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sImapUser email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
|
||||||
|
|
||||||
// Set up config
|
// Set up config
|
||||||
$config = LdapMailAccountsConfig::MakeConfig($this->Config());
|
$config = LdapMailAccountsConfig::MakeConfig($this->Config());
|
||||||
|
|
@ -52,10 +54,10 @@ class LdapMailAccountsPlugin extends AbstractPlugin
|
||||||
if ($config->bool_overwrite_mail_address_main_account)
|
if ($config->bool_overwrite_mail_address_main_account)
|
||||||
{
|
{
|
||||||
$oldapMailAccounts = new LdapMailAccounts($config, $this->Manager()->Actions()->Logger());
|
$oldapMailAccounts = new LdapMailAccounts($config, $this->Manager()->Actions()->Logger());
|
||||||
$oldapMailAccounts->overwriteEmail($sEmail, $sLogin);
|
$oldapMailAccounts->overwriteEmail($sEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sLogin email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
|
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sImapUser email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function gets called by RainLoop/Actions/User.php
|
// Function gets called by RainLoop/Actions/User.php
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue