Support methods to load and check CAPTCHA wherever a developer wants

This commit is contained in:
Kijin Sung 2025-12-17 17:37:03 +09:00
parent 01984210b6
commit 307661b57b
10 changed files with 127 additions and 11 deletions

View file

@ -20,9 +20,12 @@ class reCAPTCHA
self::$config = $config;
}
public static function check()
public static function check($response = null)
{
$response = Context::get('g-recaptcha-response');
if (!$response)
{
$response = Context::get('g-recaptcha-response');
}
if (!$response)
{
throw new Exception('msg_recaptcha_invalid_response');

View file

@ -20,9 +20,12 @@ class Turnstile
self::$config = $config;
}
public static function check()
public static function check($response = null)
{
$response = Context::get('g-recaptcha-response');
if (!$response)
{
$response = Context::get('g-recaptcha-response');
}
if (!$response)
{
throw new Exception('msg_recaptcha_invalid_response');