Captcha on user_registration conflicts with OpenID auto-registration

bdurbin - April 3, 2008 - 01:30
Project:OpenID
Version:HEAD
Component:OpenID Client
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

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

#1

bdurbin - April 9, 2008 - 00:18
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

DanielTheViking - September 2, 2008 - 08:52
Priority:normal» critical

#3

chirale - September 15, 2008 - 20:40

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

joshk - September 18, 2008 - 00:11

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

joshk - September 18, 2008 - 00:41

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!

 
 

Drupal is a registered trademark of Dries Buytaert.