mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Update UserAuth.php
Cleanup a bit through smartphone
This commit is contained in:
parent
8406bd4c9f
commit
cd0f71bdce
1 changed files with 11 additions and 13 deletions
|
|
@ -35,18 +35,18 @@ trait UserAuth
|
||||||
if (!\str_contains($sEmail, '@')) {
|
if (!\str_contains($sEmail, '@')) {
|
||||||
$this->Logger()->Write('The email address "' . $sEmail . '" is not complete', \LOG_INFO, 'LOGIN');
|
$this->Logger()->Write('The email address "' . $sEmail . '" is not complete', \LOG_INFO, 'LOGIN');
|
||||||
|
|
||||||
|
$bAdded = false;
|
||||||
|
|
||||||
if ($this->Config()->Get('login', 'determine_user_domain', false)) {
|
if ($this->Config()->Get('login', 'determine_user_domain', false)) {
|
||||||
$sUserHost = \trim($this->Http()->GetHost(false, true, true));
|
$sUserHost = \trim($this->Http()->GetHost(false, true, true));
|
||||||
$this->Logger()->Write('Determined user domain: ' . $sUserHost, \LOG_INFO, 'LOGIN');
|
$this->Logger()->Write('Determined user domain: ' . $sUserHost, \LOG_INFO, 'LOGIN');
|
||||||
|
|
||||||
$bAdded = false;
|
|
||||||
|
|
||||||
$iLimit = 14;
|
|
||||||
$aDomainParts = \explode('.', $sUserHost);
|
$aDomainParts = \explode('.', $sUserHost);
|
||||||
|
$iLimit = \min(\count($aDomainParts), 14);
|
||||||
|
|
||||||
$oDomainProvider = $this->DomainProvider();
|
$oDomainProvider = $this->DomainProvider();
|
||||||
while (\count($aDomainParts) && 0 < $iLimit) {
|
while (0 < $iLimit--) {
|
||||||
$sLine = \trim(\implode('.', $aDomainParts), '. ');
|
$sLine = \implode('.', $aDomainParts);
|
||||||
|
|
||||||
$oDomain = $oDomainProvider->Load($sLine, false);
|
$oDomain = $oDomainProvider->Load($sLine, false);
|
||||||
if ($oDomain) {
|
if ($oDomain) {
|
||||||
|
|
@ -61,20 +61,18 @@ trait UserAuth
|
||||||
}
|
}
|
||||||
|
|
||||||
\array_shift($aDomainParts);
|
\array_shift($aDomainParts);
|
||||||
$iLimit--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$bAdded) {
|
if (!$bAdded) {
|
||||||
$sLine = $sUserHost;
|
$oDomain = $oDomainProvider->Load($sUserHost, true);
|
||||||
$oDomain = $oDomainProvider->Load($sLine, true);
|
if ($oDomain) {
|
||||||
if ($oDomain && $oDomain) {
|
|
||||||
$bAdded = true;
|
$bAdded = true;
|
||||||
$this->Logger()->Write('Check "' . $sLine . '" with wildcard: OK (' . $sEmail . ' > ' . $sEmail . '@' . $sLine . ')',
|
$this->Logger()->Write('Check "' . $sUserHost . '" with wildcard: OK (' . $sEmail . ' > ' . $sEmail . '@' . $sUserHost . ')',
|
||||||
\LOG_INFO, 'LOGIN');
|
\LOG_INFO, 'LOGIN');
|
||||||
|
|
||||||
$sEmail .= '@' . $sLine;
|
$sEmail .= '@' . $sUserHost;
|
||||||
} else {
|
} else {
|
||||||
$this->Logger()->Write('Check "' . $sLine . '" with wildcard: NO', \LOG_INFO, 'LOGIN');
|
$this->Logger()->Write('Check "' . $sUserHost . '" with wildcard: NO', \LOG_INFO, 'LOGIN');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +81,7 @@ trait UserAuth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\str_contains($sEmail, '@')) {
|
if (!$bAdded) {
|
||||||
$sDefDomain = \trim($this->Config()->Get('login', 'default_domain', ''));
|
$sDefDomain = \trim($this->Config()->Get('login', 'default_domain', ''));
|
||||||
if (\strlen($sDefDomain)) {
|
if (\strlen($sDefDomain)) {
|
||||||
if ('HTTP_HOST' === $sDefDomain || 'SERVER_NAME' === $sDefDomain) {
|
if ('HTTP_HOST' === $sDefDomain || 'SERVER_NAME' === $sDefDomain) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue