Log user authentication failure type (#3950)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 8 Feb 2021 16:35:26 +0000 (17:35 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Feb 2021 16:35:26 +0000 (17:35 +0100)
See #3395

wcfsetup/install/files/acp/templates/userAuthenticationFailureList.tpl
wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php
wcfsetup/install/files/lib/acp/form/LoginForm.class.php
wcfsetup/install/files/lib/acp/form/RescueModeForm.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index 9536cc01ee1c3451426d8979e2c86652ac249d28..cddec7e82e2fe64dae9af2e71d0a0411b66177fb 100644 (file)
@@ -29,6 +29,7 @@
                                        <th class="columnText columnEnvironment{if $sortField == 'environment'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=environment&sortOrder={if $sortField == 'environment' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.user.authentication.failure.environment{/lang}</a></th>
                                        <th class="columnTitle columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th>
                                        <th class="columnDate columnTime{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.user.authentication.failure.time{/lang}</a></th>
+                                       <th class="columnText columnValidationError{if $sortField === 'validationError'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=validationError&sortOrder={if $sortField === 'validationError' && $sortOrder === 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.user.authentication.failure.validationError{/lang}</a></th>
                                        <th class="columnURL columnIpAddress{if $sortField == 'ipAddress'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=ipAddress&sortOrder={if $sortField == 'ipAddress' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.ipAddress{/lang}</a></th>
                                        <th class="columnText columnUserAgent{if $sortField == 'userAgent'} active {@$sortOrder}{/if}"><a href="{link controller='UserAuthenticationFailureList'}pageNo={@$pageNo}&sortField=userAgent&sortOrder={if $sortField == 'userAgent' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.userAgent{/lang}</a></th>
                                        
                                                        {if $authenticationFailure->userID}<a href="{link controller='UserEdit' id=$authenticationFailure->userID}{/link}">{$authenticationFailure->username}</a>{else}{$authenticationFailure->username}{/if}
                                                </td>
                                                <td class="columnDate columnTime">{@$authenticationFailure->time|time}</td>
+                                               <td class="columnText columnValidationError">
+                                                       {if $authenticationFailure->validationError}
+                                                               {lang}wcf.acp.user.authentication.failure.validationError.{$authenticationFailure->validationError}{/lang}
+                                                       {/if}
+                                               </td>
                                                <td class="columnSmallText columnIpAddress">{$authenticationFailure->getIpAddress()}</td>
                                                <td class="columnSmallText columnUserAgent" title="{$authenticationFailure->userAgent}">{$authenticationFailure->userAgent|truncate:75|tableWordwrap}</td>
                                                
index 2fdd9ca351198c858bae05fa229647779a7ea3b5..64f65a1d6f67c69f81d6042b1937e26c6e1a2ec8 100644 (file)
@@ -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"),
index 4aae8934e23c4a67d90e0ff2573f67ed412b52d6..7d36887dec0a647defbb639091303d7e5a89e352 100755 (executable)
@@ -173,6 +173,7 @@ class LoginForm extends AbstractCaptchaForm
                         'time' => TIME_NOW,
                         'ipAddress' => UserUtil::getIpAddress(),
                         'userAgent' => UserUtil::getUserAgent(),
+                        'validationError' => 'invalid' . \ucfirst($this->errorField),
                     ],
                 ]);
                 $action->executeAction();
index a2701649d31e25eafd3451cd72d6598199970370..d8d102b0fa653f2fe364f1242e39800d0f99db40 100644 (file)
@@ -261,6 +261,7 @@ class RescueModeForm extends AbstractCaptchaForm
                         'time' => TIME_NOW,
                         'ipAddress' => UserUtil::getIpAddress(),
                         'userAgent' => UserUtil::getUserAgent(),
+                        'validationError' => 'invalid' . \ucfirst($this->errorField),
                     ],
                 ]);
                 $action->executeAction();
index 4c1deaddeeb019a3661ff3e7a15144b9caaa0b34..f3237fbfc7fb888dd07bf10ac6ef11797a5eddb2 100644 (file)
@@ -3215,6 +3215,9 @@ aus Sicherheitsgründen erforderlich, dass {if LANGUAGE_USE_INFORMAL_VARIANT}du{
                <item name="wcf.acp.user.authentication.failure.time"><![CDATA[Datum]]></item>
                <item name="wcf.acp.user.authentication.failure.password"><![CDATA[Ungültiges Kennwort]]></item>
                <item name="wcf.acp.user.authentication.failure.username"><![CDATA[Unbekannter Benutzername]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError"><![CDATA[Fehler]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError.invalidPassword"><![CDATA[Falsches Passwort]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError.invalidUsername"><![CDATA[Unbekannter Benutzer]]></item>
                <item name="wcf.acp.user.activation.mail.subject"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Dein{else}Ihr{/if} Benutzerkonto auf der Website: {@PAGE_TITLE|language} wurde freigeschaltet]]></item>
                <item name="wcf.acp.user.activation.mail.html.headline"><![CDATA[Hallo {$mailbox->getUser()->username},]]></item>
                <item name="wcf.acp.user.activation.mail.html.text"><![CDATA[
index c9ac9e208fcd4ac3fc5b19dcdbe772d315d1588e..f0814b153345b7913b78812fb04acfc1fec4dfb7 100644 (file)
@@ -3139,6 +3139,9 @@ the lost password form <a href="{link controller='LostPassword' isHtmlEmail=true
                <item name="wcf.acp.user.authentication.failure.time"><![CDATA[Date]]></item>
                <item name="wcf.acp.user.authentication.failure.password"><![CDATA[Invalid Password]]></item>
                <item name="wcf.acp.user.authentication.failure.username"><![CDATA[Unknown Username]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError"><![CDATA[Error]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError.invalidPassword"><![CDATA[Incorrect password]]></item>
+               <item name="wcf.acp.user.authentication.failure.validationError.invalidUsername"><![CDATA[Unknown user]]></item>
                <item name="wcf.acp.user.activation.mail.subject"><![CDATA[Your account on the website: {@PAGE_TITLE|language} has been approved]]></item>
                <item name="wcf.acp.user.activation.mail.html.headline"><![CDATA[Dear {$mailbox->getUser()->username},]]></item>
                <item name="wcf.acp.user.activation.mail.html.text"><![CDATA[
index a252feb21f6e948925d3f1608f71e0f7247d5ae5..c035d5d883a89bfed9f6b010144eb82a010c2ff8 100644 (file)
@@ -1532,6 +1532,7 @@ CREATE TABLE wcf1_user_authentication_failure (
        time INT(10) NOT NULL DEFAULT 0,
        ipAddress VARCHAR(39) NOT NULL DEFAULT '',
        userAgent VARCHAR(255) NOT NULL DEFAULT '',
+       validationError VARCHAR(255) NOT NULL DEFAULT '',
        KEY (ipAddress, time),
        KEY (time)
 );