Download & Extend

Captcha on user_registration conflicts with OpenID auto-registration

Project:OpenID
Version:master
Component:OpenID Client
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review

Issue Summary

If captcha is installed and enabled for the user_register form, auto-registration will fail due to the captcha not being solved.
A patch is attached as one possible way to solve the issue.

Related discussion.

Steps to reproduce the issue:

1. Install Captcha
2. Install OpenID
3. Enable captcha on User Registration Form
4. Attempt OpenID registration via /user/register

Between making captcha openID-aware and making this module captcha-aware, this seems like the more direct route.

AttachmentSize
openid-captchafix.patch610 bytes

Comments

#1

Title:Captcha on user_registraion conflicts with OpenID auto-registration» Captcha on user_registration conflicts with OpenID auto-registration
Status:active» needs review

A follow-up to the above: The decision to patch on OpenID as opposed to Captcha also takes advantage of the current relative hook execution order between the two modules.

#2

Priority:normal» critical

#3

I try the patch, but I got "Hunk #1 FAILED at 467" on Drupal 6.4.
I re-implement the changes (patch attached) but OpenID registration failed.

AttachmentSize
captchafixopenid64doesntwork.patch 612 bytes

#4

FWIW, those needing quick resolution can do this with a custom form_alter like so:

<?php
function hook_form_alter(&$form, $form_state, $form_id) {
  if (
$form_id == 'user_register' && $_GET['q'] == 'openid/authenticate') {
    unset(
$form['captcha']);
  }
}
?>

#5

Just another bonus, I had a similar problem w/logintoboggan's desire to validate a "confirm email address" field. Here's a fix to both this and captcha:

<?php
function hook_form_alter(&$form, $form_state, $form_id) {
  if (
$form_id == 'user_register' && $_GET['q'] == 'openid/authenticate') {
    if (
module_exists('captcha')) {
      unset(
$form['captcha']);
    }
    if (
module_exists('logintoboggan')) {
      foreach(
$form['#validate'] as $key => $function) {
        if (
$function == 'logintoboggan_user_register_validate') {
          unset(
$form['#validate'][$key]);
        }
      }
    }  
  }
}
?>

Happy Drupaling!