Hi,

Whatever I try, the CAPTCHA does not display on user_register_form. I have no problem on the site wide contact form, I also tried the login form and there is no problem, but on the user registration form, nothing... Any idea ?

Thank you for your work on the CAPTCHA module...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guillaumev’s picture

I tried on a clean installation and it works. It's probably due to the interaction with some module... I'll keep looking...

guillaumev’s picture

I had a node reference in my user profile and it seems that's what was causing the problem. The captcha appeared after removing the node reference from the user profile...

mahfuzur’s picture

Title: CAPTCHA not displaying on user registration form » CAPTCHA is not accepting submission

Dosen't matter how many times I tried to submit captcha, it failed on user registration form. It reports " captcha didn't match"
I tried with math version. It didn't work at all.
My image version of captcha is not showing any picture.
I added few fields in user registration form. like- date of birth using date module, phone, using cck phone field, address using address field module.

Alexander Matveev’s picture

Have the same, subscribing

chrisolof’s picture

Title: CAPTCHA is not accepting submission » CAPTCHA is not appearing or not accepting submission on user registration form
Status: Active » Needs review
FileSize
524 bytes

It appears that on the registration form captcha isn't sure exactly where to put the CAPTCHA challenge, and decides to put it right before the first button it finds on the form. This doesn't work well with a registration form that contains buttons in addition to the "Create new account" button, and causes captcha to attach its form element to whatever precedes the first button, even though this isn't the submit button.

One example of this: create a node reference field that allows users to reference unlimited nodes. It will create a button "Add another item," and captcha will attach itself to the node reference field. If you have unchecked "Display on user registration form" for this field then your node reference field, as well as the CAPTCHA challenge, will be hidden. Submitting the user registration form without filling out the required CAPTCHA challenge will of course throw a validation error - even though you were never visually presented the challenge.

I have a strong suspicion that other button-containing fields one might add to users (probably anything where unlimited values are allowed) will create the same issue for the captcha module.

The fix? Attached is a small patch against the 7.x-1.x-dev branch that tells captcha to present itself before the last button in the form (as opposed to the first button), in the case that it needs to look through buttons in a form to decide where to appear.

chrisolof’s picture

Forgot to mention: it's important that you flush the captcha placement cache (admin/config/people/captcha) after applying the patch so that captcha can redetermine where the challenge should be placed using the new code.

allartk’s picture

Thanks, it worked for me!

chrisolof’s picture

Attached is an updated patch. The previous patch in comment #5 fixes the captcha placement on the registration form, but in doing so exposes another bug relating to where captcha should appear on comment forms. The attached patch fixes both bugs.

soxofaan’s picture

tagged as "D7 stable release blocker" per #1269702: Blockers to a 7.x-1.0 release?

renat’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #8 works fine for me, and testbot is also OK with it. So mark this as RTBC.

soxofaan’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
148.12 KB

Patch from #8 breaks placement on Node creation form: CAPTCHA is placed between preview and save button
(see attachment)

soxofaan’s picture

However, in http://drupalcode.org/project/captcha.git/commit/f30c544 I already committed the part from patch #8 about the node comment forms

andrechun’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
34.62 KB
30 KB

seems to be working for me on both the registration page and the node creation page and the comment form

soxofaan’s picture

@andrechun: are you sure you flushed the captcha placement cache (there is a button for this on the general captcha admin page)?

soxofaan’s picture

Title: CAPTCHA is not appearing or not accepting submission on user registration form » CAPTCHA placement issue on user registration form
Status: Reviewed & tested by the community » Needs work

Ok, this thread is getting cluttered with several unrelated issues, making it hard to follow.

Trying to get overiew:

  • original post and comments #1, #2 about missing CAPTCHA: seems to be solved
  • #3 unrelated issue about failing CAPTCHA. Not enough information to tackle this one
  • #4: poster claims to have 'same problem', but does not tell which problem
  • #5-7, #10,11,13,14: issue with wrong placement on user registration form, still not fixed, available patch breaks node creation form
  • #8, #9, #12 issue about CAPTCHA on node comment forms: already fixed

So for good understanding, let's update the title, and focus on the registration placement issue. If you have unrelated issues, please start a new thread.

soxofaan’s picture

Status: Needs work » Needs review
FileSize
3.76 KB

Good news, Drupal 7 apparently added an actions form element group, with the typical buttons we want to put the CAPTCHA stuff above of. So actually we don't need to search for all buttons and take the first or last one.
Attached patch should solve the issue for the registration form, keeps things working for node creation, comment forms, etc, and probably solves related issue for other forms too.

Can you people have a look if this indeed solves your issues too?

soxofaan’s picture

Status: Needs review » Fixed

To keep thing rolling I decided to commit the patch anyway, we are still in alpha mode:
http://drupalcode.org/project/captcha.git/commit/855288c

If you still have issues, please reopen.

soxofaan’s picture

Status: Fixed » Closed (fixed)

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

jdias’s picture

FileSize
31.48 KB

Still not working from me! The Captcha don´t appear in the Create New Account