Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Captcha throws a token failure error when submitting a form more than once, without refreshing the page #5

Closed
iDiegoNL opened this issue Jun 15, 2023 · 6 comments
Labels
bug Something isn't working more info needed

Comments

@iDiegoNL
Copy link

What happened?

The captcha throws a token failure error when submitting a form more than once, without refreshing the page.

How to reproduce the bug

Steps to reproduce:

  • Fill in a form and make sure that another validation fails, while letting the captcha pass
  • Submit the form
  • It will return the other validation message (expected behavior)
  • Now submit the form again, it does not matter whether you let the other validation pass or fail.
  • Turnstile will now throw the turnstile_check_message validation error, presumably because it's trying to re-use a token while they're single-use.

Untitled

Package Version

1.0.4

PHP Version

8.1

Laravel Version

10.13.1

Which operating systems does with happen with?

No response

Notes

No response

@iDiegoNL iDiegoNL added the bug Something isn't working label Jun 15, 2023
@ousid
Copy link
Member

ousid commented Jun 20, 2023

Hi, @iDiegoNL

Can you share the backend responsible for the form above? To demonstrate the issue, and have a solution quickly.

@iDiegoNL
Copy link
Author

@ousid I have created a repository to showcase the code and issue here: https://github.com/iDiegoNL/coderflexx-laravel-turnstile-livewire-bug-example/blob/master/app/Http/Livewire/ExamplePage.php

To reproduce the issue on the example repo, simply press the "Submit" button twice.

However, I am not sure if this issue belongs in this repo, or in the coderflexx/filament-turnstile repo.
Please do let me know if you need any other information!

@ousid
Copy link
Member

ousid commented Jun 21, 2023

@iDiegoNL I see you are using filament form, package.

Have you tried the filament package?

@iDiegoNL
Copy link
Author

@iDiegoNL I see you are using filament form, package.

Have you tried the filament package?

Yes, this issue happens with your filament package as well (see the composer.json file in the example repo that I linked) :). Therefore, i am not sure if this issue belongs in this repo, or in the other.

@ousid
Copy link
Member

ousid commented Jun 21, 2023

@iDiegoNL, yeah. That's odd.

Maybe a quick solution for now, is to have an emit event, if there is a validation error, you may refresh the captcha token. Not sure atm on how it will be done exactly. But I'll look into it later this weekend.

PS: if you have any suggestion on how to be done, or an Idea. I'll be happy to hear them out.

@ousid
Copy link
Member

ousid commented Apr 1, 2024

Fixed in coderflexx/filament-turnstile#12

Note: This feature is only available for filament V3.x, maybe I'll add it for v2.x when I have time.

@ousid ousid closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more info needed
Projects
None yet
Development

No branches or pull requests

2 participants