From e0ba6aba9f34b386e4a087e004cc5d87d16e6df9 Mon Sep 17 00:00:00 2001 From: RainLoop Date: Wed, 11 Oct 2017 22:18:41 +0300 Subject: [PATCH] Add login.login_lowercase setting (#814) --- rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php | 13 +++++++++++-- .../app/libraries/RainLoop/Config/Application.php | 2 ++ .../RainLoop/Providers/Storage/FileStorage.php | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 3cbda6e85..1c6cfe6f5 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1272,7 +1272,7 @@ class Actions if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) { $oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); - $this->Plugins()->RunHook('filter.acount', array(&$oAccount)); + $this->Plugins()->RunHook('filter.account', array(&$oAccount)); if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Model\Account)) { @@ -2145,7 +2145,11 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $this->Plugins()->RunHook('filter.login-credentials.step-1', array(&$sEmail, &$sPassword)); - $sEmail = \MailSo\Base\Utils::StrToLowerIfAscii(\MailSo\Base\Utils::Trim($sEmail)); + $sEmail = \MailSo\Base\Utils::Trim($sEmail); + if ($this->Config()->Get('login', 'login_lowercase', true)) + { + $sEmail = \MailSo\Base\Utils::StrToLowerIfAscii($sEmail); + } if (false === \strpos($sEmail, '@')) { @@ -2231,6 +2235,11 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $this->Logger()->AddSecret($sPassword); $sLogin = $sEmail; + if ($this->Config()->Get('login', 'login_lowercase', true)) + { + $sLogin = \MailSo\Base\Utils::StrToLowerIfAscii($sLogin); + } + $this->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword)); $this->Logger()->AddSecret($sPassword); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 7a34a38dc..c7b04989e 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -255,6 +255,8 @@ class Application extends \RainLoop\Config\AbstractConfig 'forgot_password_link_url' => array('', ''), 'registration_link_url' => array('', ''), + 'login_lowercase' => array(true, ''), + 'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DEFAILT_OFF, 'This option allows webmail to remember the logged in user once they closed the browser window. diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php index 50eca4dde..f62a73892 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php @@ -150,8 +150,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage $sEmail = $mAccount; } - $sEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sEmail); - $sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sSubEmail); + $sEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sEmail); + $sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sSubEmail); $sTypePath = $sKeyPath = ''; switch ($iStorageType)