Use the reCAPTCHA Enterprise API.
This commit is contained in:
@@ -41,8 +41,18 @@ function xxx_page_route() {
|
||||
file_put_contents("$state/tables.ser", serialize(array('tables' => SiteData::$tables,
|
||||
'passwordLength' => SiteData::$passwordLength)), LOCK_EX);
|
||||
});
|
||||
FakeRecaptcha::install(function ($post) {
|
||||
return json_encode(array('success' => ($post['response'] ?? '') === 'pass'));
|
||||
FakeRecaptcha::install(function ($post) use ($file) {
|
||||
$token = $post['event']['token'] ?? '';
|
||||
if ($token === 'unreachable')
|
||||
return FALSE;
|
||||
if ($token === 'api-error')
|
||||
return '{"error":{"code":403,"status":"PERMISSION_DENIED"}}';
|
||||
$action = $file === XXX_ROOT . '/publish/login.php' ? 'login' : 'submit';
|
||||
return json_encode(array('tokenProperties' => array(
|
||||
'valid' => in_array($token, array('pass', 'wrong-host', 'wrong-action'), TRUE),
|
||||
'hostname' => $token === 'wrong-host' ? 'evil.example' : 'site.test',
|
||||
'action' => $token === 'wrong-action' ? 'other' : $action,
|
||||
)));
|
||||
});
|
||||
|
||||
if (!isset($_SERVER['HTTP_X_TEST_PLAIN']))
|
||||
|
||||
Reference in New Issue
Block a user