From 8494a7cb91a444de2b8770fc34593598180ff99e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 8 Feb 2021 17:35:26 +0100 Subject: [PATCH] Log user authentication failure type (#3950) See #3395 --- .../files/acp/templates/userAuthenticationFailureList.tpl | 6 ++++++ .../install/files/acp/update_com.woltlab.wcf_5.4_db.php | 6 ++++++ wcfsetup/install/files/lib/acp/form/LoginForm.class.php | 1 + .../install/files/lib/acp/form/RescueModeForm.class.php | 1 + wcfsetup/install/lang/de.xml | 3 +++ wcfsetup/install/lang/en.xml | 3 +++ wcfsetup/setup/db/install.sql | 1 + 7 files changed, 21 insertions(+) diff --git a/wcfsetup/install/files/acp/templates/userAuthenticationFailureList.tpl b/wcfsetup/install/files/acp/templates/userAuthenticationFailureList.tpl index 9536cc01ee..cddec7e82e 100644 --- a/wcfsetup/install/files/acp/templates/userAuthenticationFailureList.tpl +++ b/wcfsetup/install/files/acp/templates/userAuthenticationFailureList.tpl @@ -29,6 +29,7 @@ {lang}wcf.acp.user.authentication.failure.environment{/lang} {lang}wcf.user.username{/lang} {lang}wcf.acp.user.authentication.failure.time{/lang} + {lang}wcf.acp.user.authentication.failure.validationError{/lang} {lang}wcf.user.ipAddress{/lang} {lang}wcf.user.userAgent{/lang} @@ -46,6 +47,11 @@ {if $authenticationFailure->userID}{$authenticationFailure->username}{else}{$authenticationFailure->username}{/if} {@$authenticationFailure->time|time} + + {if $authenticationFailure->validationError} + {lang}wcf.acp.user.authentication.failure.validationError.{$authenticationFailure->validationError}{/lang} + {/if} + {$authenticationFailure->getIpAddress()} {$authenticationFailure->userAgent|truncate:75|tableWordwrap} diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php index 2fdd9ca351..64f65a1d6f 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php @@ -74,6 +74,12 @@ $tables = [ DefaultFalseBooleanDatabaseTableColumn::create('multifactorActive'), ]), + PartialDatabaseTable::create('wcf1_user_authentication_failure') + ->columns([ + NotNullVarchar255DatabaseTableColumn::create('validationError') + ->defaultValue(''), + ]), + PartialDatabaseTable::create('wcf1_user_avatar') ->columns([ DefaultFalseBooleanDatabaseTableColumn::create("hasWebP"), diff --git a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php index 4aae8934e2..7d36887dec 100755 --- a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php @@ -173,6 +173,7 @@ class LoginForm extends AbstractCaptchaForm 'time' => TIME_NOW, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent(), + 'validationError' => 'invalid' . \ucfirst($this->errorField), ], ]); $action->executeAction(); diff --git a/wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php b/wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php index a2701649d3..d8d102b0fa 100644 --- a/wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php @@ -261,6 +261,7 @@ class RescueModeForm extends AbstractCaptchaForm 'time' => TIME_NOW, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent(), + 'validationError' => 'invalid' . \ucfirst($this->errorField), ], ]); $action->executeAction(); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4c1deaddee..f3237fbfc7 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3215,6 +3215,9 @@ aus Sicherheitsgründen erforderlich, dass {if LANGUAGE_USE_INFORMAL_VARIANT}du{ + + + getUser()->username},]]> + + + getUser()->username},]]>