mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 11:13:27 +02:00
Fixes
This commit is contained in:
@@ -41,21 +41,17 @@ class GoogleReCAPTCHA
|
||||
}
|
||||
|
||||
$json = json_decode($response);
|
||||
//log_append('recaptcha.log', 'recaptcha_score: ' . $json->score . ', action:' . $json->action);
|
||||
if (!isset($json->action) || $json->action !== $action) {
|
||||
self::$errorType = self::ERROR_INVALID_ACTION;
|
||||
self::$errorMessage = 'Google ReCaptcha returned invalid action.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$recaptchaType = config('recaptcha_type');
|
||||
if ($recaptchaType === 'v3') { // score based
|
||||
log_append('recaptcha.log', 'recaptcha_score: ' . $json->score . ', action:' . $json->action);
|
||||
if (!isset($json->action) || $json->action !== $action) {
|
||||
self::$errorType = self::ERROR_INVALID_ACTION;
|
||||
self::$errorMessage = 'Google ReCaptcha returned invalid action.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($json->score) || $json->score < config('recaptcha_v3_min_score')) {
|
||||
self::$errorType = self::ERROR_LOW_SCORE;
|
||||
self::$errorMessage = 'Your Google ReCaptcha score was too low.';
|
||||
return false;
|
||||
}
|
||||
if (!isset($json->score) || $json->score < config('recaptcha_min_score')) {
|
||||
self::$errorType = self::ERROR_LOW_SCORE;
|
||||
self::$errorMessage = 'Your Google ReCaptcha score was too low.';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($json->success) || !$json->success) {
|
||||
|
@@ -17,5 +17,5 @@
|
||||
</div>
|
||||
</noscript>
|
||||
{% if config.recaptcha_enabled %}
|
||||
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||
{% endif %}
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={{ config.recaptcha_site_key }}"></script>
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user