Skip to content

Commit b1b1902

Browse files
authored
Merge pull request #981 from nep/nep-patch-captcha
Improving CAPTCHA documentation
2 parents 2f91eaf + 96ebf69 commit b1b1902

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

docs/control-panel/settings/captcha.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ This section of the Control Panel allows you to set the [CAPTCHA](security/captc
1717

1818
### Require CAPTCHA?
1919

20-
If you enable this preference, then site visitors will be required to pass a CAPTCHA to submit any front-end form, including Channel Form, comment forms, contact forms, and member registrations. If members are logged in, they will not have to enter a CAPTCHA unless the [Require CAPTCHA while logged in?](#require-captcha-while-logged-in) preference is enabled.
20+
If you enable this preference, then site visitors will be required to pass a CAPTCHA to submit any front-end form, including [channel forms](security/captchas.md#channel-forms), [comment forms](security/captchas.md#comment-forms), contact and tell-a-friend email forms](#contact-and-tell-a-friend-email-forms), and [member registrations](security/captchas.md#member-registration-forms).
21+
22+
If members are logged in, they will not have to enter a CAPTCHA unless the [Require CAPTCHA while logged in?](#require-captcha-while-logged-in) preference is enabled.
23+
24+
Superadmins are not required to submit a captcha and are never shown one.
2125

2226
### Require CAPTCHA while logged in?
2327

2428
If you enable this preference, then even members who are logged in will need to fill out CAPTCHA information in order to post, for example, comments (assuming you've enabled CAPTCHA support for comment posting). If you disable this setting, then members who are logged in will bypass the CAPTCHA check.
2529

2630
### Use reCAPTCHA v3?
2731

28-
If you enable this preference then the system will use reCAPTCHA v3 in place of the built-in image based solution.
32+
If you enable this preference then the system will use reCAPTCHA v3 in place of the built-in image based solution. You will also want to ensure that you [update any code](security/captchas.md#captcha-code) used to output CAPTCHAs on your site.
2933

3034
## Built-in CAPTCHA Settings
3135

@@ -57,7 +61,9 @@ If you do not know what to use for your full server path, contact your Host or s
5761

5862
## reCAPTCHA v3 Settings
5963

60-
If you wish to use (Google reCAPTCHA v3)[https://cloud.google.com/security/products/recaptcha#how-it-works] as a replacement for the built-in functionality, you will need to ensure that the site is set up with Google with the required site key and secret. Note that there is currently a monthly limit on the number of free CAPTCHAs that Google provides. See https://www.google.com/recaptcha/admin/create
64+
If you wish to use (Google reCAPTCHA v3)[https://cloud.google.com/security/products/recaptcha#how-it-works] as a replacement for the built-in functionality, you will need to ensure that the site is set up with Google with the required site key and secret.
65+
66+
Note that there is currently a monthly limit on the number of free CAPTCHAs that Google provides. See https://www.google.com/recaptcha/admin/create
6167

6268
### reCAPTCHA site key
6369

docs/security/captchas.md

+34-18
Original file line numberDiff line numberDiff line change
@@ -11,52 +11,68 @@
1111

1212
[TOC]
1313

14-
ExpressionEngine supports what are known as "CAPTCHAs", or Completely Automated Public Turing tests to tell Computers and Humans Apart. A CAPTCHA is a computer-generated test that humans can easily pass, but that is computationally difficult for a computer to do.
14+
A CAPTCHA, as a general concept, is a computer-generated test that humans can easily pass, but that is computationally difficult for a computer to do. They are used when you want to ensure that a human is performing an action, not an automated script -- often to block spam.
1515

16-
So how does this work? An image is generated in real time for a user loading a web page. This image contains a word that the user must enter in a form. The concept is effective because computers are generally not very good at reading images, but it is something humans can do with little effort.
16+
ExpressionEngine has built-in support for CAPTCHAs (Completely Automated Public Turing tests to tell Computers and Humans Apart), and can also use (Google's reCAPTCHA v3)[https://cloud.google.com/security/products/recaptcha].
17+
18+
So how does the built-in CAPTCHA functionality work?
19+
20+
When a user loads a web page with a form protected by a CAPTCHA, EE generates a unique image in real time. This image contains a word that the user must enter when they submit a form. The CAPTCHA is effective because computers are generally not very good at reading images, but it is something humans can do with little effort.
1721

1822
In ExpressionEngine, CAPTCHAs can be used in several places:
1923

20-
- [CAPTCHAs](#captchas)
21-
- [Comment Forms](#comment-forms)
22-
- [Member Registration Form](#member-registration-form)
23-
- [Contact and Tell-a-Friend Email Forms](#contact-and-tell-a-friend-email-forms)
24-
- [CAPTCHA Code](#captcha-code)
25-
- [Notes](#notes)
26-
- [CAPTCHA Words](#captcha-words)
24+
- [To submit a comment](#comment-forms)
25+
- [To register a new member](#member-registration-forms)
26+
- [In the Contact and Tell-a-Friend email forms](#contact-and-tell-a-friend-email-forms)
27+
- [In Channel Forms](#channel-forms)
28+
29+
The settings to require CAPTCHAs for these forms are located at [`Settings --> CAPTCHA`](control-panel/settings/captcha.md) in the control panel.
2730

28-
The settings to require CAPTCHAs for these forms are located at `Settings --> CAPTCHA` in the control panel.
31+
The CAPTCHA settings are applied site-wide. If you have CAPTCHAS required, they will be required for all of the following uses with the same settings. If other add-ons integrate the use of EE's captcha system, they will also be controlled by the same settings.
2932

3033
## Comment Forms
3134

32-
Once you have the preference turned on, you'll need to add the CAPTCHA code to your [Comment Submission Form](comment/form.md). See below for the [CAPTCHA Code](#captcha-code).
35+
If you have CAPTCHAS required, you'll need to add the CAPTCHA code to your [Comment Submission Form](comment/form.md). See below for the [CAPTCHA Code](#captcha-code).
3336

34-
## Member Registration Form
37+
## Member Registration Forms
3538

3639
The necessary CAPTCHA code already exists in the Member Templates by default, so you should not need to add it. If you have a version of ExpressionEngine from before the CAPTCHA feature was added or if you otherwise need the code, see below for the [CAPTCHA Code](#captcha-code).
3740

3841
## Contact and Tell-a-Friend Email Forms
3942

40-
Once you have the preference turned on, you'll need to add the CAPTCHA code. See below for the [CAPTCHA Code](#captcha-code).
43+
If you have CAPTCHAS required, you'll need to add the CAPTCHA code to these forms in order to submit properly. See below for the [CAPTCHA Code](#captcha-code).
44+
45+
## Channel Forms
46+
47+
If you have CAPTCHAS required, you'll need to add the CAPTCHA code to your [Channel Entry Form](channels/channel-form/overview.md#captcha). See below for the [CAPTCHA Code](#captcha-code).
4148

4249
## CAPTCHA Code
4350

51+
This is the code for Comment forms, Contact forms, and Channel Entry forms.
52+
4453
{if captcha}
4554
<p>Please enter the word you see in the image below:</p>
46-
<p>{captcha}<br /> <input type="text" name="captcha" value="{captcha_word}" size="20" maxlength="20" style="width:140px;" /></p>
55+
<p>{captcha}<br />
56+
<input type="text" name="captcha" value="{captcha_word}" size="20" maxlength="20" style="width:140px;" /></p>
4757
{/if}
4858

49-
The contents of the conditional {if captcha} tag will only appear if you have the CAPTCHA preference turned on for either the comment or member registration forms.
59+
The contents of the conditional `{if captcha}` tag will be displayed if you:
60+
61+
- have the CAPTCHA setting turned on
62+
- are not logged in as a superadmin (Superadmins never have to pass a CAPTCHA test)
63+
- are not logged in (only if you have "Require CAPTCHA while logged in?" enabled)
64+
65+
The `{captcha}` tag itself will be an image tag if you are using the built-in CAPTCHA.
5066

51-
The code used inside the Member Registration Form is very similar, with only the omission of the {captcha_word} variable:
67+
The code used in the Member Registration Form is very similar, with only the omission of the {captcha_word} variable:
5268

5369
{if captcha}
5470
<p>Please enter the word you see in the image below:</p>
5571
<p>{captcha}<br />
5672
<input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" /></p>
5773
{/if}
5874

59-
If using using [reCAPTCHA v3](security/captchas.md), use a simplified tag that will output the required javascript, with the CAPTCHA otherwise invisible.
75+
If you are using [Google's reCAPTCHA v3](security/captchas.md), use this simplified code in all cases. The `{captcha}` tag will output the required JavaScript, the CAPTCHA is invisible, and there is no need for an input field.
6076

6177
{if captcha}
6278
{captcha}
@@ -72,7 +88,7 @@ For ExpressionEngine installations that power multiple domains or subdomains, yo
7288

7389
## CAPTCHA Words
7490

75-
The CAPTCHA system uses a default dictionary. You can override these by adding a special user config file and returning an array of words you want to use instead. Create a PHP file at `system/user/config/captcha.php` with the format:
91+
The CAPTCHA system uses a default dictionary. You can override these by adding a special user config file that returns an array of words you want to use instead. Create a PHP file at `system/user/config/captcha.php` with the format:
7692

7793
<?php
7894

docs/troubleshooting/templates.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,17 @@ Ensure that the channel field is being called within the template. For example,
6464

6565
## CAPTCHA images not appearing
6666

67-
CAPTCHAs are enabling but there is a blank space where they should appear.
67+
CAPTCHAs are enabled but there is a blank space where they should appear.
6868

6969
### Troubleshooting missing CAPTCHA Images
7070

7171
There are several possible reasons for CAPTCHA images to not appear:
7272

73-
- The path and/or URL to the CAPTCHA directory is not specified correctly under `Settings --> CAPTCHA`.
73+
- The path and/or URL to the CAPTCHA directory is not specified correctly under [`Settings --> CAPTCHA`](control-panel/settings/captcha.md).
7474
- The `images/captchas/` directory is not writable. See [File Permissions](troubleshooting/general.md#file-permissions) for details.
7575
- The server does not support True Type Fonts. TrueType Fonts can be disabled in `Settings --> CAPTCHA`.
7676
- GD library isn't installed and/or working correctly
77+
- You are logged in as a superadmin, and superadmins are not required to solve CAPTCHAs
7778

7879
## Can not save a template with the {exp:query} tag
7980

0 commit comments

Comments
 (0)