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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded django-recaptcha to 4.0.0. (馃幎 one more time 馃幎 ) #1485

Closed

Conversation

bmispelon
Copy link
Member

@bmispelon bmispelon commented Feb 22, 2024

OK folks, I think this one might stick.

I tested it locally by getting my own recaptcha keys and I can then see that the captcha is validated (I get an error from stripe which seems to indicate that things will work once in production: No such product: 'dummy_monthly_id').

There were three things I had to change compared to the original commit 16787c8:

  • Work around django-recaptcha automatically submitting the form (Issue with django-recapture v4 and form submit event listeners聽django-recaptcha/django-recaptcha#348) by disabling their onsubmit event and doing the call to grecaptcha.execute(...) manually.
  • Make sure to set the returned token value to the captcha form field (this part was missing in my previous attempt 901bdd9
  • Make sure that both the widget declared on the form and the js use the same action, otherwise the captcha validation fails (this was also missing in my previous attempt).

I've got a good feeling about this one 馃馃徎

EDIT I had to fix some tests that were breaking because the recaptcha test keys don't work with a custom action as documented in https://github.com/django-recaptcha/django-recaptcha/?tab=readme-ov-file#local-development-and-functional-testing

@bmispelon bmispelon force-pushed the django-recaptcha-v4.0.0-real-final-v2 branch from b3ec8ee to ea8a3cd Compare February 22, 2024 22:28
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
@felixxm felixxm force-pushed the django-recaptcha-v4.0.0-real-final-v2 branch from ea8a3cd to 973c394 Compare February 23, 2024 05:11
@felixxm
Copy link
Member

felixxm commented Feb 23, 2024

Thanks 馃憤

Merged in 3179425.

@felixxm felixxm closed this Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants