Skip to content

Commit e0ba6ab

Browse files
committed
Add login.login_lowercase setting (RainLoop#814)
1 parent 6f4b7b8 commit e0ba6ab

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '', $
12721272
if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
12731273
{
12741274
$oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
1275-
$this->Plugins()->RunHook('filter.acount', array(&$oAccount));
1275+
$this->Plugins()->RunHook('filter.account', array(&$oAccount));
12761276

12771277
if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Model\Account))
12781278
{
@@ -2145,7 +2145,11 @@ public function LoginProcess(&$sEmail, &$sPassword, $sSignMeToken = '',
21452145

21462146
$this->Plugins()->RunHook('filter.login-credentials.step-1', array(&$sEmail, &$sPassword));
21472147

2148-
$sEmail = \MailSo\Base\Utils::StrToLowerIfAscii(\MailSo\Base\Utils::Trim($sEmail));
2148+
$sEmail = \MailSo\Base\Utils::Trim($sEmail);
2149+
if ($this->Config()->Get('login', 'login_lowercase', true))
2150+
{
2151+
$sEmail = \MailSo\Base\Utils::StrToLowerIfAscii($sEmail);
2152+
}
21492153

21502154
if (false === \strpos($sEmail, '@'))
21512155
{
@@ -2231,6 +2235,11 @@ public function LoginProcess(&$sEmail, &$sPassword, $sSignMeToken = '',
22312235
$this->Logger()->AddSecret($sPassword);
22322236

22332237
$sLogin = $sEmail;
2238+
if ($this->Config()->Get('login', 'login_lowercase', true))
2239+
{
2240+
$sLogin = \MailSo\Base\Utils::StrToLowerIfAscii($sLogin);
2241+
}
2242+
22342243
$this->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword));
22352244

22362245
$this->Logger()->AddSecret($sPassword);

rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ protected function defaultValues()
255255
'forgot_password_link_url' => array('', ''),
256256
'registration_link_url' => array('', ''),
257257

258+
'login_lowercase' => array(true, ''),
259+
258260
'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DEFAILT_OFF,
259261
'This option allows webmail to remember the logged in user
260262
once they closed the browser window.

rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = fals
150150
$sEmail = $mAccount;
151151
}
152152

153-
$sEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sEmail);
154-
$sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sSubEmail);
153+
$sEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sEmail);
154+
$sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sSubEmail);
155155

156156
$sTypePath = $sKeyPath = '';
157157
switch ($iStorageType)

0 commit comments

Comments
 (0)