As CAPTCHA is an annoyance for all users, every step toward simplification is welcome.

So, instead of telling the user "do not enter spaces", why not just *remove* them in captcha_validate() ?

Another minor comment, not worth an issue : the #title and #description are, IMHO, redundant.

Personally, I would have set the #title to something like "Validation code", "Robot|Spam|Whatever protection", or even "CAPTCHA".

But "de coloribus et gustibus..."

Comments

soxofaan’s picture

Makes sense and I think it perfectly fits in the current list of of validation options (currently 'case sensitive' and 'case insensitive')

Out of curiosity: Did you observe users entering spaces or you just want to simplify the help text?

about your remark on the #title/#description: I do think it is worth an issue: #646552: Layout/theming of image CAPTCHA

dropall’s picture

Out of curiosity: Did you observe users entering spaces or you just want to simplify the help text?

I wish I had users ;-( my site is not yet on line.

It's just a rule I try to follow : don't bother users with problems that a computer can easily solve.

And especially for captcha which is bothering anyway.

soxofaan’s picture

Assigned: Unassigned » soxofaan
Status: Active » Needs review
StatusFileSize
new43.78 KB
new41.36 KB
new9.58 KB

here is a first patch

suggestion for better wording?

soxofaan’s picture

StatusFileSize
new22.48 KB

last screenshot of previous post was wrong
this one should be better

dropall’s picture

+function captcha_validate_ignore_spaces($solution, $response) {
+  return preg_replace('/\s/', '', $solution) == preg_replace('/\s/', '', $solution);
+}

This should always validate, or am I missing something ?

"$response" should be involved somewhere. And why preg_replace "$solution", as it is supposed not to have spaces in it ?

But this is a minor point compared to the difference between your solution and the one I expected.

IMO, we can't compare the case sensitivity with the spaces problem.

Case sensitivity : the administrator chooses between "ease of use" and "captcha strength". So this feature is highly needed.

Spaces : there are never spaces in the image (even if users can "see" them). So we only need to strip them from the user response. There is no sense in blocking a user which enters a correct code with extra spaces. So my patch would have been a simple preg_replace in the validate function, not a new option.

Should you persist in the "new option" way, I'd ask you to create the "case sensitive/ignore spaces" option, which is needed for administrators who need stronger captcha and trust a user returning a correct code with spaces in it.

Anyway, thank you for your commitment and your reactivity.

soxofaan’s picture

Status: Needs review » Needs work

...
"$response" should be involved somewhere.
...

Of course, stupid me. I'll make a new patch.

Now, with my proposed patch, the feature is in the general CAPTCHA module, which also supports other challenges than the image CAPTCHA. For example, the CSS CAPTCHA from CAPTCHA pack could also benefit from this feature, that's why I've put it as an option in the general CAPTCHA module.

To me, case insensitivity and space insensitivity are much alike because they both increase ease of use for humans, that's why I've put them together. I don't completely understand why they are different to you.
I even considered only two options:
* strict validation
* case insensitive + space insensitive validation

If I understand you correctly, you want the space ignoring feature only in the image CAPTCHA, and make it always active, without any option in the admin interface?

About also stripping spaces in the $solution: this is because some challenges (not the image CAPTCHA of course) could have spaces in the solution, so only stripping the spaces in the $response wouldn't work.

dropall’s picture

Now, with my proposed patch, the feature is in the general CAPTCHA module, which also supports other challenges than the image CAPTCHA.

Of course, I've totally overlooked this fact. My comments must be read in "image captcha" context.

<oldprogrammerrumination>

We face here what I call the "orthogonalisation syndrome" :

1) The module is designed to accept a broad range of input parameters, this allows future extensions. GOOOOD !

2) In the parameters matrix, some cells are meaningless. Normal, we leave in the real world and not all imaginable objects exist.

3) As far as the meaningless cases are handled internally, there is no problem. But, in my very personal opinion, when these cases are exposed to the user, either the programmer has been too lazy to implement internal shortcuts, or the generalisation has been pushed too far.

</oldprogrammerrumination>

If I understand you correctly, you want the space ignoring feature only in the image CAPTCHA, and make it always active, without any option in the admin interface?

Yes. Only in the image captcha, because I don't use or know other modules, so I can't say. And yes, always active without any option, because I can't imagine an administrator willing to block people who enter a correct code with spaces in it.

soxofaan’s picture

Status: Needs work » Needs review
StatusFileSize
new3.56 KB

this patch should do it:

Added new space ignoring validation functions in captcha.module (so other modules can just reuse these if they want)
Image CAPTCHA now ignores spaces.

I also simplified the description of the image CAPTCHA it is now always 'Enter the characters shown in the image.', even with case sensitive validation

dropall’s picture

With less code, the unwanted case is now hidden from administrators and from users. Good job !

Thank you.

Let's hope nobody will come with a different opinion on the subject :-)

soxofaan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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