Use the reCAPTCHA Enterprise API.
This commit is contained in:
@@ -10,15 +10,16 @@ namespace Xxx\Tests\Support;
|
||||
* returns one of these.
|
||||
*/
|
||||
class FakeRecaptcha {
|
||||
public const PASS = '{"tokenProperties":{"valid":true,"hostname":"site.test","action":"submit"}}';
|
||||
public static array $requests = array();
|
||||
public static $reply = '{"success": true}';
|
||||
public static $reply = self::PASS;
|
||||
private static bool $active = FALSE;
|
||||
|
||||
public $context;
|
||||
private string $data = '';
|
||||
private int $position = 0;
|
||||
|
||||
public static function install($reply = '{"success": true}'): void {
|
||||
public static function install($reply = self::PASS): void {
|
||||
self::$requests = array();
|
||||
self::$reply = $reply;
|
||||
if (!self::$active) {
|
||||
@@ -38,7 +39,7 @@ class FakeRecaptcha {
|
||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
||||
$context = $this->context ? stream_context_get_options($this->context) : array();
|
||||
$http = $context['http'] ?? array();
|
||||
parse_str((string)($http['content'] ?? ''), $post);
|
||||
$post = json_decode((string)($http['content'] ?? ''), TRUE) ?? array();
|
||||
self::$requests[] = array('url' => $path, 'http' => $http, 'post' => $post);
|
||||
$reply = self::$reply instanceof \Closure ? (self::$reply)($post) : self::$reply;
|
||||
if ($reply === FALSE)
|
||||
|
||||
Reference in New Issue
Block a user