If I install reCAPTCHA and set it to be used by a form but I do not configure reCAPTCHA, any page which should contain the reCAPTCHA is blank except for this message:

To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create

This has the potential to completely break a web site. If reCAPTCHA is not configured, Drupal should behave as if there is no CAPTCHA configured or perhaps fall-back to a default CAPTCHA.

(I wonder what happens if reCAPTCHA is properly configured, but the reCAPTCHA servers go down or are inaccessible. Does that also trigger a similar problem?)

Comments

Liam Morland’s picture

Status:Active» Needs review
StatusFileSize
new2.37 KB

The reCAPTCHA module calls die() when not configured. The attached patch causes it to instead display a message and always behave as if the CAPTCHA was valid. In other words, having reCAPTCHA unconfigured will not break your site.

Liam Morland’s picture

StatusFileSize
new730 bytes

Going through the code some more, I have come up with a much better solution. This one only changes recaptcha.module and causes CAPTCHA to fallback to the built-in math CAPTCHA when reCAPTCHA is not configured.

Liam Morland’s picture

StatusFileSize
new618 bytes

I must be having a slow day. Here is a simpler, better patch that implements the fallback to math.

RobLoach’s picture

Status:Needs review» Reviewed & tested by the community

Thanks! Looks good! Mind committing this it? :-)

RobLoach’s picture

Assigned:Unassigned» Liam Morland
Liam Morland’s picture

Status:Reviewed & tested by the community» Fixed

Fixed in e1515c0.

Liam Morland’s picture

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:Fixed» Patch (to be ported)
Liam Morland’s picture

Assigned:Liam Morland» Unassigned
Liam Morland’s picture

  • Liam Morland committed e1515c0 on 7.x-1.x, 7.x-2.x
    Issue #1681746: Fallback to Math if reCAPTCHA is not configured.
    

  • Liam Morland committed e1515c0 on 8.x-2.x
    Issue #1681746: Fallback to Math if reCAPTCHA is not configured.
    

  • Liam Morland committed e1515c0 on 6.x-2.x
    Issue #1681746: Fallback to Math if reCAPTCHA is not configured.
    
hass’s picture

Issue summary:View changes
Status:Patch (to be ported)» Fixed

  • hass committed 8ab3aad on 6.x-1.x authored by Liam Morland
    Issue #1681746 by Liam Morland: Page is blank when reCAPTCHA not...