Problem/Motivation
The captcha.settings description has no limit as a text string in configuration, but the CAPTCHA settings form prevents input greater than 256 characters. It is then possible to import a longer description, but then lose that description if a user saves the form.
We should avoid data loss. Either the settings should also be constricted to 256 characters or a different form element is used to allow for longer text strings. I think that there is not a reason to limit the number of characters in the description.
This is probably a holdover from Drupal 7 variables.
Steps to reproduce
- Log in as an administrative user on a site with config module enabled.
- Import the below YAML Basic configuration into the site
- Visit a form with a captcha. The description is displayed in full.
- Visit the Captcha settings form. The description is cut off in the input to 256 characters (by design)
- Save the form
- Visit a form with a captcha. The description that was imported is lost.
sample captcha.settings.yml
enable_globally: 1
enable_globally_on_admin_routes: FALSE
default_challenge: 'captcha/Math'
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent iaculis euismod metus eu tempor. Maecenas tincidunt turpis enim, et blandit nisi pulvinar ac. Sed in nibh libero. Fusce a ante eget metus dapibus tincidunt. Donec fringilla sed ante ac venenatis. Vivamus tincidunt diam eget sapien at. '
title: 'CAPTCHA'
administration_mode: FALSE
administration_mode_on_admin_routes: FALSE
whitelist_ips: ''
wrong_captcha_response_message: 'The answer you entered for the CAPTCHA was not correct.'
default_validation: 1
persistence: 1
enable_stats: FALSE
log_wrong_responses: FALSE
langcode: en
Proposed resolution
Change the "Description" field from a text field to a text area so that it is easier to write text that may exceed the input box (even 256 characters makes it difficult to write). Potentially also change the "Wrong CAPTCHA response error message" field to a text area as well. Remove the max length property on both fields.
Remaining tasks
- Merge request and any test fixes.
User interface changes
The Captcha settings form Description and Wrong CAPTCHA response error message fields are changed to text areas and allow longer input.
API changes
No.
Data model changes
No. CAPTCHA already supports longer description and error strings.