mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Update recaptcha addon to throw exceptions on error
This commit is contained in:
parent
d8a0773b97
commit
54f0346a50
1 changed files with 4 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ class reCAPTCHA
|
||||||
$response = Context::get('g-recaptcha-response');
|
$response = Context::get('g-recaptcha-response');
|
||||||
if (!$response)
|
if (!$response)
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'recaptcha.msg_recaptcha_invalid_response');
|
throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_invalid_response');
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
@ -31,17 +31,17 @@ class reCAPTCHA
|
||||||
}
|
}
|
||||||
catch (\Requests_Exception $e)
|
catch (\Requests_Exception $e)
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'recaptcha.msg_recaptcha_connection_error');
|
throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_connection_error');
|
||||||
}
|
}
|
||||||
|
|
||||||
$verify = @json_decode($verify_request->body, true);
|
$verify = @json_decode($verify_request->body, true);
|
||||||
if ($verify && isset($verify['error-codes']) && in_array('invalid-input-response', $verify['error-codes']))
|
if ($verify && isset($verify['error-codes']) && in_array('invalid-input-response', $verify['error-codes']))
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'recaptcha.msg_recaptcha_invalid_response');
|
throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_invalid_response');
|
||||||
}
|
}
|
||||||
elseif (!$verify || !$verify['success'] || (isset($verify['error-codes']) && $verify['error-codes']))
|
elseif (!$verify || !$verify['success'] || (isset($verify['error-codes']) && $verify['error-codes']))
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'recaptcha.msg_recaptcha_server_error');
|
throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_server_error');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue