So I'm using recaptcha 1.2 with Captcha 2.0-rc2 and this causes each page with recaptcha to go blank (says "read api.recaptcha.net").

So I install Captcha 1.0-rc2 and this causes each comment post with recaptcha to be "Invalid captcha token". It refuses to post.

Bear in mind, I am also using AJAX Comments module (so perhaps this has been a cause). This seems to be pretty urgent bug, I recommend quickly trying a recaptcha 1.2, captcha 2.0-rc2, and ajax comments the latest, combination and quickly patching this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RobLoach’s picture

Title: Invalid Token Captcha » Compatibility with AJAX Comments
Project: reCAPTCHA » CAPTCHA
Version: 6.x-1.2 » 6.x-2.x-dev
Component: reCAPTCHA Captcha » Captcha API (captcha)
Status: Active » Needs work

This seems like a pretty strange use case, and I'm not sure how it would work with reCAPTCHA since the is a straight script tag rather then a nice reCAPTHCA jQuery API. If you figure something out with it, I'd love to take a look.

Throwing it over to the CAPTCHA guys as they might know more then me.

soxofaan’s picture

I'm not very experienced with Javascript, so the problem is also foggy for me.

I guess this is related to #487032: admin mode problem with Egglue/reCAPTCHA, which has comparable symptoms when a reCAPTCHA or egglue challenge is placed in a collapsible fieldset.

I think this is a problem of conflicting javascript between the AJAX comment script and the reCAPTCHA script, or between the Drupal fieldset collapsing javascript and the reCAPTCHA script. I think the problem is not in the CAPTCHA module itself, but on another level, however I'm ok with keeping it in this issue queue for now.

I hope someone with better javascript/jquery skills can look into this problem. Rob?

RobLoach’s picture

Title: Compatibility with AJAX Comments » Compatibility with CAPTCHA
Project: CAPTCHA » AJAX Comments
Version: 6.x-2.x-dev » 6.x-1.x-dev
Component: Captcha API (captcha) » Miscellaneous
Priority: Critical » Normal

Let's try throwing it over to the AJAX Comments guys and see what they say.

executex’s picture

Man, does anyone have any ideas? IF you do, I'll try and take a whack at the JS and see if I can fix it myself.

Anyone have AJAX comments---Recaptcha---captcha combination working properly? If so, what versions?

neochief’s picture

I have 8 sites propertly working with ajax_comments + standard captcha

RobLoach’s picture

Title: Compatibility with CAPTCHA » AJAX API
Project: AJAX Comments » reCAPTCHA
Component: Miscellaneous » reCAPTCHA Captcha
Category: bug » feature

Thanks, neochief. It probably doesn't work with reCAPTCHA then because reCAPTCHA loads its resources from the external service, not expecting it to be an AJAX call. To make reCAPTCHA work with AJAX comments, I believe we'd have to add to the module to use the reCAPTCHA AJAX API.

executex’s picture

alright I'll give it a shot... though I don't know how I'm suppose to implement AJAX API parallel to the module? Do I just put in the JS include?

madlee’s picture

I don't think this bug has anything to do with comments. I don't have comments enabled and I get the same result as the original poster. However, I only get it on the admin side of the site.

executex’s picture

There's definitely a bug in recaptcha module, and recaptcha being incompatible with AJAX Comments or perhaps CAPTCHA. Though I'm pretty sure I used recaptcha perfectly when AJAX comments weren't installed.

madlee’s picture

For me, it seems that it only happens in the admin section. If I remove the ability to administer the captcha from the form, it doesn't go to the all white page.

wrockwood’s picture

happening for me on several sites, with jquery stuff installed, but no fancy AJAX modules at all. As far as I know, I'm not calling captcha/recaptcha via jquery.. commenting on a post does a page load, but anyone with "skip captcha" permission just gets the blank white page with "read api.recaptcha.net" in the status bar. Pretty frustrating that I can't track this issue down, so here I am. *subscribe*

Any suggestions are welcome. Thanks.

edit: adding version infos

drupal 6.13

/* $Id: recaptcha.module,v 1.13.2.4.2.11.2.6 2009/06/16 21:25:56 robloach Exp $ */

// $Id: captcha.module,v 1.96 2009/07/02 23:45:05 soxofaan Exp $

perhaps this is fixed in a later -dev? or not broken in an earlier -stable? Thanks in advance for any help or suggestions you can offer.

executex’s picture

Yes I have EXACTLY this problem too.
If I use recaptcha and CAPTCHA... I get this "read from api.recaptcha.net" as soon as comment is submitted ( a blank WHITE page)

I would think it's a pretty easy fix, I don't know why these guys never figure it out.

executex’s picture

I've been looking through the code, and it doesn't seem to be an AJAX API issue. AJAX API is used to generate dynamically, the recaptcha form, quickly.

It has NOTHING to do with submitting a recaptcha form.

And like I said --- RECAPTCHA DOESN'T WORK WITH CAPTCHA NOT AJAX COMMENTS.
Try a drupal installation with captcha 2.x and recaptcha the latest, and you will see, it goes to "read api.recaptcha.net" in the status bar, and a blank WHITE page.

RobLoach’s picture

I would absolutely love any help in fixing the issue. It may be an easy fix, but many of us have other obligations and priorities. The places where I'm using reCAPTCHA, it works very well. Without knowing more about your situation, it's hard to know exactly what's going on. If you manage to figure something out, then I'd be more then willing to commit a fix to the module, or even help out in debugging. So, post more information about where you're using it. Maybe a link? Maybe a step by step process of how you set it up? Then we might be able to help you out, otherwise we're just treading in the dark.

Thanks.

................CAPTCHA 2.x? Are you in Drupal 5 or 6? Use the stable version of CAPTCHA, not the dev version.

executex’s picture

Alright, I'm going to delete all my captcha, recaptcha files, uninstall, take off the modules. Then reinstall everything... and I'm going to use recaptcha 1.2 and captcha 2.0rc-1...

Hmmmmm
I rechecked my API keys too, and it seems like I was using a different key for some reason. Perhaps that might have been the problem.

Perhaps a proper error message for "Wrong API key" or something is required?

I tested now it works with both browsers ... ONLY -- WHEN YOU ARE NOT on administrator account. On anonymous, everything works fine. When you log in as admin it goes to a blank white page after it gets to recaptcha_get_html or whatever, and then says in status bar "Read api.recaptcha.net"

UPDATE: On the white blank page, this source code appears if you stop the script on the white blank page:

<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha.js"></script><div id="recaptcha_widget_div" style="display:none"></div><script>Recaptcha.widget = Recaptcha.$("recaptcha_widget_div"); Recaptcha.challenge_callback();</script>

Next I'll try AJAX comments. >>>
AJAX comments enabled, now it says "Recaptcha you entered was incorrect" --- But it still posts the comment... Weird!

executex’s picture

By the way , you really have to communicate with me, maybe send me your GTAlk or something, because I'm the only one reviewing the code right now.

You've already lost 2500 people who use to use recaptcha, and everyone is leaving recaptcha in mass, it simply doesn't work anymore.

soxofaan’s picture

re #14 regarding how to reproduce:
This is a minimal Drupal form where the problem occurs: a reCAPTCHA challenge inside a collapsible fieldset

$form['fieldset'] = array(
  '#type' => 'fieldset',
  '#title' => 'Collapsible fieldset',
  '#collapsible' => TRUE,
);
$form['fieldset']['challenge'] = array(
  '#type' => 'captcha',
  '#captcha_type' => 'recaptcha/reCAPTCHA',
);

Disclaimer: I have no drupal setup around for the moment, so I didn't test the code, e.g.: I'm not sure if there also should be a submit button.
Note that there is no AJAX comments in the mix, it's only Drupal+CAPTCHA+reCAPTCHA.
(Also note that this snippet uses a new feature of CAPTCHA API 6.x-2.x to hardcode the placement and CAPTCHA type in a form)

If you set '#collapsible' to FALSE, everything should work,
but if you set '#collapsible' to TRUE, you get a white page of death with "read api.recapcha.net"

RobLoach’s picture

I just made a rather large commit that switches from using #input and #process in the form to $captcha['captcha_validate']. It might help as it works closely to what the CAPTCHA API expects, but I'm not squre it will solve this whitescreen problem we're running into. I've testing it a bunch of times locally, and it seems to be working.

matt_moran’s picture

I just struggled with this issue for several hours. I tried both the production and the dev versions of reCAPTCHA. Same result.

My workaround is to uncheck "Add CAPTCHA administration links to forms" under admin/user/captcha.

Unfortunately I need to re-enable it whenever I want to add a CAPTCHA to a new form, but once the CAPTCHA is added and I have the right "form_id" I can disable it again.

It's not perfect, but it works.

cfischer50’s picture

Just updated modules, including RECAPTCHA ... still the read api.recaptcha.net and white page.

My current solution is to set all of the forms in the Administer->User Administration -> CAPTCHA global settings to default challenge type and leave admin links in forms. Then when I set up a new form, I go into the CAPTCHA global settings and switch the challenge type to Math. Then switch it back to RECAPTCHA when the form is completed. AARGHF! But it works.

I run a second browser application so I can check not-logged-in because, of course, as admin I cannot look at the form again.

Francewhoa’s picture

FileSize
44.11 KB

Confirming this issue.

#19 temporary fix works for me. Thanks matt_moran. So it seems that the Add CAPTCHA administration links to forms option is related to this issue. Because when it's deactivated everything is working fine. Find attached screenshot to clarify.

My setup:
-Drupal 6.14
-CAPTCHA 6.x-2.0-rc3
-reCAPTCHA 6.x-1.2
-I do NOT use AJAX Comments module
-Firefox 3, Galeon 2
-End user OS: Ubuntu Desktop 8.04 LTS
-Server OS: Ubuntu Server 8.04 LTS

soxofaan’s picture

I'd like to clarify some things (I stated this before, but it doesn't hurt to repeat this for new readers/followers):
The problem/bug with the white page and "Read api.recaptcha.net" is not in the "CAPTCHA administration links" feature itself. The problem occurs when the reCAPTCHA challenge is placed in a collapsible fieldset.

The CAPTCHA administration links case is just the most common case where the reCAPTCHA widget ends up in a collapsible fieldset. Also note that the CAPTCHA administration links only appear for users with CAPTCHA-admin permissions, so normal non-admin users should not suffer from this issue.

soxofaan’s picture

Hi all,

FYI:
In preparation for a final CAPTCHA 6.x-2.0 release I added temporary workaround for the problem with the CAPTCHA admin preview of reCAPTCHA (and Egglue):
reCAPTCHA and Egglue are now blacklisted for the CAPTCHA admin preview and don't show up in the CAPTCHA admin links:
http://drupal.org/cvs?commit=265144

Note that this is a temporary workaround (in the CAPTCHA module) to address this issue in the reCAPTCHA module.
This workaround should be removed once the bug/problem itself is solved.

Francewhoa’s picture

Thanks for clarifying soxofaan. And thanks for the temporary workaround.

executex’s picture

It's been about 7 months, and this is STILL an issue with the whole "white page read api.recaptcha.net". I still haven't figured out a workaround, non of what you guys suggested works. My "add administration link" is ALREADY unchecked.

Drupal 6.15
CAPTCHA 2.1
reCaptcha 1.4

no ajax comments.

It must differ from theme to theme though, because other websites DO WORK properly with it. So someone needs to figure out how a theme function or theme can mess with this and cause this strange bewildering error. I been looking into it, but I can't find it.

executex’s picture

Version: 6.x-1.x-dev » 6.x-1.4
Category: feature » bug
Priority: Normal » Critical
Status: Needs work » Active

I think this is an important issue, I don't know if you agree but I hope you do because this happens in many websites and is the reason why recaptcha is losing popularity.

mikey_p’s picture

Assigned: Unassigned » mikey_p

I've got a quick patch for this against the 1.4 release. I'll try to reroll this against HEAD and post it in a few days.

ChaosD’s picture

subscribed

GreenReaper’s picture

supscribed

mikey_p’s picture

Status: Active » Needs review
FileSize
3.25 KB

This just switches that Recaptcha JS and HTML on the form to use their AJAX API for loading the widget. Nothing else is changed as even AJAX submissions in Drupal go through the Form API, so all the same validation works for both.

mikey_p’s picture

BTW I'm using this in a comment form that's hidden by default, and then displayed in a thickbox, and submitted with ajax comments. It works well.

GreenReaper’s picture

I've applied this but I'm still getting issues with AJAX Comments. If I hit reply on someone else's comments with Chrome (as an anonymous user), everything disappears except for the captcha.

mikey_p’s picture

@GreenReaper That sounds more like an issue with ajax_comments, not recaptcha, or this patch.

This patch should also work just fine without ajax_comments. To test, simply add a a div around the comment form with some javascript to show/hide it, hidden by default. With the non-ajax version this won't work.

hadsie’s picture

The patch in #30 works great for me. Thanks @mikey_p

RobLoach’s picture

Status: Needs review » Fixed
bleen’s picture

Status: Fixed » Needs review
FileSize
1.02 KB

The patch in #30 works well for me ... but if we are using AJAX to display the recaptcha challenge, shouldn't we turn page caching back on (if it was on)?

This patch does that...

During testing I made sure that several anon users could successfully pass the recaptcha challenge even if page caching is on ...

(patched against 6.x-dev)

RobLoach’s picture

Should we put cache invalidation into a variable? The CAPTCHA module does it for some reason. Think it should be pushed over to the CAPTCHA module on the administration page? Hmmm.

bleen’s picture

any more thoughts?

bleen’s picture

bump ... would love to see the patch in #36 committed

RobLoach’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

would love to see the patch in #36 committed

Me too! I just added you as a CVS maintainer :-) .

bleen’s picture

Status: Reviewed & tested by the community » Fixed

Sweet ... thanks Rob!

Committed to 6.x-1.x-dev

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.