Add login.login_lowercase setting (#814)

This commit is contained in:
RainLoop 2017-10-11 22:18:41 +03:00
parent 6f4b7b8156
commit e0ba6aba9f
3 changed files with 15 additions and 4 deletions

View file

@ -1272,7 +1272,7 @@ class Actions
if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
{ {
$oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); $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)) 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)); $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, '@')) if (false === \strpos($sEmail, '@'))
{ {
@ -2231,6 +2235,11 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$this->Logger()->AddSecret($sPassword); $this->Logger()->AddSecret($sPassword);
$sLogin = $sEmail; $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->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword));
$this->Logger()->AddSecret($sPassword); $this->Logger()->AddSecret($sPassword);

View file

@ -255,6 +255,8 @@ class Application extends \RainLoop\Config\AbstractConfig
'forgot_password_link_url' => array('', ''), 'forgot_password_link_url' => array('', ''),
'registration_link_url' => array('', ''), 'registration_link_url' => array('', ''),
'login_lowercase' => array(true, ''),
'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DEFAILT_OFF, 'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DEFAILT_OFF,
'This option allows webmail to remember the logged in user 'This option allows webmail to remember the logged in user
once they closed the browser window. once they closed the browser window.

View file

@ -150,8 +150,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
$sEmail = $mAccount; $sEmail = $mAccount;
} }
$sEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sEmail); $sEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sEmail);
$sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sSubEmail); $sSubEmail = \preg_replace('/[^a-z0-9\-\.@]+/i', '_', $sSubEmail);
$sTypePath = $sKeyPath = ''; $sTypePath = $sKeyPath = '';
switch ($iStorageType) switch ($iStorageType)