I've some problem with captcha 5.x-3.1 with ldap users provisioning module (5.x-1.x-dev):
captcha works everywhere, but for form_id user user_register captcha does not appears... In other form_ids like user_login or user_pass, captcha works perfectly.
If I disable ldapprov, captcha appears again...
Is needed an hack to make captcha+ldapprov work?!

Drupal version's 5.9 on LAMP environment.

Regards,
-f

Comments

soxofaan’s picture

Project: CAPTCHA » LDAP provisioning
Version: 5.x-3.1 » 5.x-1.x-dev

I'm don't have LDAP in my toolbox, so I can't really test this.

But from skimming trough the source code, it appears that ldap_provisioning tries to interact with the CAPTCHA module by reading and writing directly from/in the captcha_point table:

  // line 462
  if (module_exists('captcha')) {
    $result = db_query("SELECT * FROM {captcha_points} WHERE form_id = 'ldapprov_register'");
    $captcha = ($row = db_fetch_object($result)) ? 1 : 0;
    $form['general']['ldapprov_captcha'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use captcha in the registration form.'),
      '#default_value' => $captcha,
    );
  }
 // ...
 // line 793
    if (module_exists('captcha')) {
      $result = db_query("SELECT * FROM {captcha_points} WHERE form_id = 'ldapprov_register'");
      $row = db_fetch_object($result);
      if ($edit['ldapprov_captcha'] == 1 && empty($row)) {
        db_query("INSERT INTO {captcha_points} (form_id) VALUES ('ldapprov_register')");
      }
      elseif ($edit['ldapprov_captcha'] == 0 && !empty($row)) {
        db_query("DELETE FROM {captcha_points} WHERE form_id = 'ldapprov_register'");
      }
    }

This is however not compatible with how the CAPTCHA module (5.x-3.x and 6.x-1.x) uses the captcha_point table

for example, this is how the CAPTCHA module check if a CAPTCHA should be added to a form:

  // captcha.module line 425
    // Get CAPTCHA type and module for this form. Return if no CAPTCHA was set.
    $result = db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id);
    if (!$result) {
      return;
    }
    $captcha_point = db_fetch_object($result);
    if (!$captcha_point || !$captcha_point->type) {
      return;
    }

and this is how the CAPTCHA module disables or enables a CAPTCHA on a form:

  // captcha.module line 393
   if ($captcha_type == 'none') {
      db_query("UPDATE {captcha_points} SET module = NULL, type = NULL WHERE form_id = '%s'", $captcha_point_form_id);
    }
    else {
      list($module, $type) = explode('/', $captcha_type);
      db_query("UPDATE {captcha_points} SET module = '%s', type = '%s' WHERE form_id = '%s'", $module, $type, $captcha_point_form_id);
    }
 

This should be fixed in ldap_provisioning.

rosseba’s picture

stefaan,

thanks for your reply.
sorry but I'm not a PHP guru or so :-( : suggest to me contact directly ldap_provisioning mainteiner and ask directly with him about this trouble?
regards,
-f

davea’s picture

I can confirm this issue in the same environment.

DaveA

rosseba’s picture

I've just update to 5.x-1.0-alpha1 version of module: issue still persist... :-(
Any news about it?!
Thanks,
-f

miglius’s picture

The code in ldap_provisioning perfectly works with the captcha module. I guess that this is a configuration issue.

To enable captcha in the ldap provisioning:

1. go to ldap provisioning configuration "admin/settings/ldapprov" and enable captcha by selecting "Use captcha in the registration form.".

2. Go to captcha configuration page "admin/user/captcha" and there you will see a row with a form id "ldapprov_register". Go on and enable it.

That's it. The captcha should appear in the ldap provisioning registration form.

rosseba’s picture

miglius,

you're right: now it's works...!
thank you for the tip!

-f

miglius’s picture

Assigned: Unassigned » miglius
Category: bug » support
Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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