Skip to content
Snippets Groups Projects
Commit ecce3d7d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added random delay for showing captcha

parent 46b56fa8
No related branches found
No related tags found
5 merge requests!1645Development,!1641Development,!1635Development,!1634Development,!1631Development
......@@ -39,6 +39,7 @@ class HumanVerification extends Controller
$key = strtolower($key);
if (!$hasher->check($key, $lockedKey)) {
sleep(\random_int(1, 8));
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
HumanVerification::saveUser($user);
......@@ -65,6 +66,7 @@ class HumanVerification extends Controller
}
}
}
sleep(\random_int(1, 8));
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
HumanVerification::saveUser($user);
......
......@@ -80,7 +80,7 @@ class HumanVerification
}
}
}
# A lot of automated requests are from websites that redirect users to our result page.
# We will detect those requests and put a captcha
$referer = URL::previous();
......@@ -98,9 +98,10 @@ class HumanVerification
if ((!$alone && $sum >= 50 && !$user["whitelist"]) || $refererLock) {
$user["locked"] = true;
}
# If the user is locked we will force a Captcha validation
if ($user["locked"]) {
sleep(\random_int(1, 8));
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
\App\PrometheusExporter::CaptchaShown();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment