Skip to content

Require reCaptcha even when g-recaptcha-response is empty #738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/global/code/Submissions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ public static function processFormSubmission($form_data)
exit;
}

// was there a reCAPTCHA response? If so, a recaptcha was just submitted. This generally implies the
// form page included the API, so check it was entered correctly. If not, return the user to the webpage
if (isset($api_enabled) && isset($form_data["g-recaptcha-response"])) {

// Are the reCaptcha config variables set? If so, a recaptcha is required so check it is valid.
// If not, return the user to the webpage.
if (isset($api_enabled) && ! empty(Core::getAPIRecaptchaSecretKey()) && ! empty(Core::getApiRecaptchaSiteKey())) {
$api = new API(array("init_core" => false));
$api->includeRecaptchaLib();
$resp = $api->validateRecaptcha($form_data["g-recaptcha-response"]);
Expand Down