Ajax validation triggering Turnstile duplication error

Created on 23 July 2025, 7 days ago

Problem/Motivation

We hit an issue on a registration form where Turnstile was always failing even though it was a success. Turns out it was a "The response parameter has already been validated before" error from Turnstile which is caused by receiving the same request twice. We worked out this was due to the Username Validation β†’ module's ajax validation setting being set on. When you type in the username field it makes a validation request which triggers turnstile and then when you submit properly you get the duplication error.

Steps to reproduce

Currently only recreated with the username validation module (switching off their ajax validation makes Turnstile work fine so we've just left it like that in production to stop the issue). Happy to test by making another ajax element inside a form to work out if it's how that module is doing ajax or if it's a wider issue with ajax elements inside forms. Other Captcha systems work fine (probably just because of lighter duplication handling).

Proposed resolution

Only handle captcha when the whole form has been submitted? If so I suspect this would be something needed upstream at Captcha itself.

Happy to pop an issue in on the username validation module or help patch this if it's something we should be doing here.

Thanks!

πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom FilipNest

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

Comments & Activities

  • Issue created by @FilipNest
  • πŸ‡ΊπŸ‡ΈUnited States greatmatter

    I think this might belong in the username validation module, but if I'm wrong, we can try to figure out a way around it. I don't use the module, but if I had to guess, it's submitting the form every time the username field is changed? If that's the case, it would be an awful lot of validations.

    There should be an option to prevent future verifications if the first one passes, though I'm not certain that will work in this use-case.

Production build 0.71.5 2024