From ddb688933a20320cc69f4db4c94e292aae7281fc Mon Sep 17 00:00:00 2001 From: Dominik Hebeler <dominik@suma-ev.de> Date: Tue, 11 Jun 2019 12:15:31 +0200 Subject: [PATCH] removed the temp spam removal --- app/Http/Controllers/HumanVerification.php | 15 ++++----------- app/Http/Middleware/HumanVerification.php | 9 --------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/HumanVerification.php b/app/Http/Controllers/HumanVerification.php index 671147738..2132aaa12 100644 --- a/app/Http/Controllers/HumanVerification.php +++ b/app/Http/Controllers/HumanVerification.php @@ -26,16 +26,6 @@ class HumanVerification extends Controller } if ($request->getMethod() == 'POST') { - $dowCheck = true; - # Temp remove later - # Check for recent Spams - if (\preg_match("/eingabe=[\\d]{3}\s*chan.*$/si", $url)) { - # Sleep a random time - $rand = rand(0, 15); - sleep($rand); - $dowCheck = false; - } - $user = $redis->hgetall(HumanVerification::PREFIX . "." . $id); $user = ['uid' => $user["uid"], 'id' => $user["id"], @@ -49,7 +39,7 @@ class HumanVerification extends Controller $key = $request->input('captcha'); $key = strtolower($key); - if (!$dowCheck || !$hasher->check($key, $lockedKey)) { + if (!$hasher->check($key, $lockedKey)) { $captcha = Captcha::create("default", true); $pipeline = $redis->pipeline(); $pipeline->hset(HumanVerification::PREFIX . "." . $id, 'lockedKey', $captcha["key"]); @@ -200,6 +190,9 @@ class HumanVerification extends Controller public static function couldBeSpammer($ip) { + if (!env("REMOVE_SPAM_IN_TOR")) { + return false; + } $serverAddress = empty($_SERVER['SERVER_ADDR']) ? "144.76.88.77" : $_SERVER['SERVER_ADDR']; $queryUrl = "https://tor.metager.org?password=" . urlencode(env("TOR_PASSWORD")) . "&ra=" . urlencode($ip) . "&sa=" . urlencode($serverAddress) . "&sp=443"; diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index d60cf7ddc..3689591f1 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -101,15 +101,6 @@ class HumanVerification "lockedKey" => "", ]; } - # Temp remove later - # Check for recent Spams - $eingabe = \Request::input('eingabe'); - if (\preg_match("/^[\\d]{3}\s*chan.*$/si", $eingabe)) { - # Sleep a random time between 1 and 5 seconds - $rand = rand(0, 5); - sleep($rand); - $user["locked"] = true; - } # A lot of automated requests are from websites that redirect users to our result page. # We will detect those requests and put a captcha -- GitLab