mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Merge Actions::getAdditionalLogParamsByUserLogin() into Actions::LoggerAuthHelper()
This commit is contained in:
parent
f32f5347a7
commit
9fc4d8f953
3 changed files with 17 additions and 17 deletions
|
|
@ -532,8 +532,22 @@ class Actions
|
||||||
return $this->oPlugins;
|
return $this->oPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function LoggerAuthHelper(?Model\Account $oAccount = null, array $aAdditionalParams = array(), bool $admin = false): void
|
protected function LoggerAuthHelper(?Model\Account $oAccount = null, string $sLogin, bool $admin = false): void
|
||||||
{
|
{
|
||||||
|
if ($sLogin) {
|
||||||
|
$sHost = $admin ? $this->Http()->GetHost(true, true) : \MailSo\Base\Utils::GetDomainFromEmail($sLogin);
|
||||||
|
$aAdditionalParams = array(
|
||||||
|
'{imap:login}' => $sLogin,
|
||||||
|
'{imap:host}' => $sHost,
|
||||||
|
'{smtp:login}' => $sLogin,
|
||||||
|
'{smtp:host}' => $sHost,
|
||||||
|
'{user:email}' => $sLogin,
|
||||||
|
'{user:login}' => $admin ? $sLogin : \MailSo\Base\Utils::GetAccountNameFromEmail($sLogin),
|
||||||
|
'{user:domain}' => $sHost,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$aAdditionalParams = array();
|
||||||
|
}
|
||||||
$sLine = $this->oConfig->Get('logs', 'auth_logging_format', '');
|
$sLine = $this->oConfig->Get('logs', 'auth_logging_format', '');
|
||||||
if (!empty($sLine)) {
|
if (!empty($sLine)) {
|
||||||
if (!$this->oLoggerAuth) {
|
if (!$this->oLoggerAuth) {
|
||||||
|
|
@ -808,20 +822,6 @@ class Actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAdditionalLogParamsByUserLogin(string $sLogin, bool $bAdmin = false): array
|
|
||||||
{
|
|
||||||
$sHost = $bAdmin ? $this->Http()->GetHost(true, true) : \MailSo\Base\Utils::GetDomainFromEmail($sLogin);
|
|
||||||
return array(
|
|
||||||
'{imap:login}' => $sLogin,
|
|
||||||
'{imap:host}' => $sHost,
|
|
||||||
'{smtp:login}' => $sLogin,
|
|
||||||
'{smtp:host}' => $sHost,
|
|
||||||
'{user:email}' => $sLogin,
|
|
||||||
'{user:login}' => $bAdmin ? $sLogin : \MailSo\Base\Utils::GetAccountNameFromEmail($sLogin),
|
|
||||||
'{user:domain}' => $sHost,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function DoPing(): array
|
public function DoPing(): array
|
||||||
{
|
{
|
||||||
return $this->DefaultResponse('Pong');
|
return $this->DefaultResponse('Pong');
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ trait UserAuth
|
||||||
throw new ClientException(Notifications::AuthError);
|
throw new ClientException(Notifications::AuthError);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $oException) {
|
} catch (\Throwable $oException) {
|
||||||
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));
|
$this->LoggerAuthHelper($oAccount, $sInputEmail);
|
||||||
throw $oException;
|
throw $oException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class ActionsAdmin extends Actions
|
||||||
!$this->Config()->ValidatePassword($oPassword)
|
!$this->Config()->ValidatePassword($oPassword)
|
||||||
|| ($totp && !\SnappyMail\TOTP::Verify($totp, $this->GetActionParam('TOTP', ''))))
|
|| ($totp && !\SnappyMail\TOTP::Verify($totp, $this->GetActionParam('TOTP', ''))))
|
||||||
{
|
{
|
||||||
$this->LoggerAuthHelper(null, $this->getAdditionalLogParamsByUserLogin($sLogin, true), true);
|
$this->LoggerAuthHelper(null, $sLogin, true);
|
||||||
$this->loginErrorDelay();
|
$this->loginErrorDelay();
|
||||||
throw new ClientException(Notifications::AuthError);
|
throw new ClientException(Notifications::AuthError);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue