diff --git a/recaptcha.admin.inc b/recaptcha.admin.inc index 694cd1f..60fb9a9 100644 --- a/recaptcha.admin.inc +++ b/recaptcha.admin.inc @@ -41,6 +41,12 @@ function recaptcha_admin_settings() { '#default_value' => variable_get('recaptcha_ajax_api', FALSE), '#description' => t('Use the AJAX API to display reCAPTCHA.'), ); + $form['recaptcha_nocookies'] = array( + '#type' => 'checkbox', + '#title' => t('Disable Client-Side Cookies'), + '#default_value' => variable_get('recaptcha_nocookies', FALSE), + '#description' => t('Add flag to disable third-party cookies set by reCAPTCHA.'), + ); $form['recaptcha_theme_settings'] = array( '#type' => 'fieldset', '#title' => t('Theme Settings'), diff --git a/recaptcha.module b/recaptcha.module index 49250b6..e35152e 100644 --- a/recaptcha.module +++ b/recaptcha.module @@ -84,6 +84,7 @@ function recaptcha_captcha() { $recaptcha_theme = variable_get('recaptcha_theme', 'red'); $recaptcha_tabindex = variable_get('recaptcha_tabindex', NULL); $recaptcha_public_key = variable_get('recaptcha_public_key', ''); + $recaptcha_nocookies = variable_get('recaptcha_nocookies',FALSE); $recaptcha_form_value = NULL; $recaptcha_ajax_api = variable_get('recaptcha_ajax_api', FALSE); @@ -129,6 +130,13 @@ function recaptcha_captcha() { // Create the form. Captcha requires TRUE to be returned in solution. $captcha['solution'] = TRUE; $captcha['captcha_validate'] = 'recaptcha_captcha_validation'; + + // If 'Disable Client-Side Cookies' is set, then add query string to end of the public key string before passing to recaptchalib + + if ($recaptcha_nocookies) { + $recaptcha_public_key .= "&nocookie=1"; + } + $html = recaptcha_get_html($recaptcha_public_key, NULL, $recaptcha_secure_connection); $captcha['form']['captcha_response'] = array( '#type' => 'hidden',