reCaptcha over SSL

Permalink Browser Info Environment
I'm writing this down because it could save time to someone else and for future memory.

I needed to have reCaptcha challenge via SSL because my site is served via HTTPS. I'm using the wonderful add on reCaptcha which allows you to use reCaptcha instead of SecureImage (concrete5 default).
The problem is that when your site works on HTTPS, if the challenge request is made via simple HTTP the result is that you will not receive any captcha (the challenge image will not show up).
The solution is in the function recaptcha_get_html() contained in the recaptchalib.php file. This function accepts three parameters, but only the first one is mandatory:

function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)


The solution for sending the requests via HTTPS is to set the third parameter to true when this function gets called.
It is used in the file recaptcha/models/system/captcha/types/recaptcha/controller.php at line 19, as it is possible to see below:

echo recaptcha_get_html($keys['recaptcha_key_public']);


If you want the requests to be made over SSL, you have to modify that line in this way:

echo recaptcha_get_html($keys['recaptcha_key_public'],null,true);


Hope it helps someone.

I don't know if there is a way to set this parameter via some configuration. Maybe I missed something?

Anyway, thanks for the addon.
Cheers.

Type: Discussion
Status: New
Je4n
View Replies:
mlocati replied on at Permalink Reply
mlocati
I'm gonna updating the add-on, thanks for reporting this issue!
mlocati replied on at Permalink Reply
mlocati
I just uploaded version 0.9.1 that automatically detects HTTPS.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.