Download & Extend

Use recaptcha with multidomains thanks keys module

Project:reCAPTCHA
Version:6.x-1.x-dev
Component:reCAPTCHA Captcha
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

Keys module give an api to manage keys by domains. I make a patch so recaptcha use it.
Thanks to that, i can manage multiple keys for a site wich use mysite.com for english site and monsite.fr for french site.

Comments

#1

Version:6.x-1.7» 6.x-1.x-dev
Status:active» needs review

Here si the patch (Should use same way to mailhide module)

Does this seems correct to you ?

AttachmentSize
recaptcha-use-keys-to-manage-recaptcha-keys-1399586-1.patch 5.63 KB

#2

Status:needs review» needs work

I like it a lot! :-)

+++ b/recaptcha.admin.incundefined
@@ -13,22 +13,38 @@ function recaptcha_admin_settings() {
+      '#type' => 'item',
+      '#title' => t('Public Key'),
+      '#description' => t('The public key given to you when you <a href="@url" target="_blank">registered at reCAPTCHA.net</a>.', array('@url' => url(recaptcha_get_signup_url($_SERVER['SERVER_NAME'], variable_get('site_name', ''))))),
+      '#value' => t('Managed by <a href="@url">Keys</a>.', array('@url' => url('admin/settings/keys'))),

Instead of having it as a value, could we have it so that the textfield becomes disabled, and the description gets replaced about Keys being used?

+++ b/recaptcha.moduleundefined
@@ -171,8 +187,8 @@ function recaptcha_captcha_validation($solution = NULL, $response = NULL) {
     $resp = recaptcha_check_answer(
-      variable_get('recaptcha_private_key', ''),
-      ip_address(),
+      _recaptcha_get_key('private'),
+      $user->hostname,
       $_POST['recaptcha_challenge_field'],
       $_POST['recaptcha_response_field']

Is the ip_address() change needed?

#3

Also, is there going to be a Drupal 7 stable version of Keys module anytime soon? I'd like to keep the reCAPTCHA branches as close as possible.

#4

Yes it's possible to have textfield (disabled) instead of #item (see patch)
ip_address() change isn't needed (sorry for this copy/paste error)

I don't know if keys module will have a stable version soon (i'm only user of it). But it's seems to be under development regardless to issues (less than one month). But no commits since 4 months...

AttachmentSize
recaptcha-use-keys-to-manage-recaptcha-keys-1399586-4.patch 5.34 KB

#5

This worked great for me.
Using Drupal 6.22, Keys 6x-2.1, and ReCAPTCHA 6x-1.7 (+ your patch)

Thank you!
Great timing. I moved a site live today and needed this to fix the issue.
And it plays nicely along side GMap using Keys also.

nobody click here