Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2019-12-31 04:14:06 +0300
committerGitHub <noreply@github.com>2019-12-31 04:14:06 +0300
commitf11b1827cd3d9ceb92683a40cb3bebe3a94713fc (patch)
treeef3980bb3c68deeeadfd81f31fd6c46fb006aca8 /plugins/TwoFactorAuth
parent71f81a7541cee64cbdf7879dd34b2f1176fa8390 (diff)
Fix log tmp segment may be too long (#15312)
* Fix log tmp segment may be too long * fix tests
Diffstat (limited to 'plugins/TwoFactorAuth')
-rw-r--r--plugins/TwoFactorAuth/Controller.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/TwoFactorAuth/Controller.php b/plugins/TwoFactorAuth/Controller.php
index fdbe4fb8ef..bb37cd5a64 100644
--- a/plugins/TwoFactorAuth/Controller.php
+++ b/plugins/TwoFactorAuth/Controller.php
@@ -10,6 +10,8 @@ namespace Piwik\Plugins\TwoFactorAuth;
use Endroid\QrCode\QrCode;
use Piwik\API\Request;
use Piwik\Common;
+use Piwik\Container\StaticContainer;
+use Piwik\IP;
use Piwik\Nonce;
use Piwik\Piwik;
use Piwik\Plugins\Login\PasswordVerifier;
@@ -91,6 +93,14 @@ class Controller extends \Piwik\Plugin\Controller
Url::redirectToUrl(Url::getCurrentUrl());
} else {
$messageNoAccess = Piwik::translate('TwoFactorAuth_InvalidAuthCode');
+ try {
+ $bruteForce = StaticContainer::get('Piwik\Plugins\Login\Security\BruteForceDetection');
+ if ($bruteForce->isEnabled()) {
+ $bruteForce->addFailedAttempt(IP::getIpFromHeader());
+ }
+ } catch (Exception $e) {
+ // ignore error eg if login plugin is disabled
+ }
}
} else {
$messageNoAccess = Piwik::translate('Login_InvalidNonceOrHeadersOrReferrer', array('<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/how-to-install/#faq_98">', '</a>'));