CAPTCHA persistence ignored when 'cacheable' attribute is enabled

Created on 1 January 2025, 4 months ago

Problem/Motivation

CAPTCHA persistence settings are ignored when using certain CAPTCHA types, such as reCAPTCHA or Turnstile. As a result, the CAPTCHA is always displayed on forms, regardless of the configured persistence options.

This issue occurs because when the cacheable attribute is set in hook_captcha_captcha, the CAPTCHA module does not update the CAPTCHA status to 'resolved' after a successful completion. As a result, persistence fails, as it primarily depends on the status being correctly updated.

Steps to reproduce

  1. Enable and configure the reCAPTCHA module or another CAPTCHA module that supports a cacheable CAPTCHA type (e.g., the Turnstile module), as the CAPTCHA module itself does not provide a cacheable type.
  2. At /admin/config/people/captcha, select the option "Omit challenges on all forms once the user successfully responds to any challenge on the site."
  3. Add a reCAPTCHA CAPTCHA to a form.
  4. Complete the form, solving the CAPTCHA, and submit it.
  5. Revisit the form and observe that the CAPTCHA is still required.

Proposed resolution

Fix how captcha status is handled when cacheable attribute is set.

Remaining tasks

  • Resolve the isssue.
  • Add tests.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024