How to check if recaptcha passed in ajax? #260
-
I really like this lib, but how can I add an extra client side (ajax) check if the recaptcha was successfully completed? I see the following code, but I am not sure how I am supposed to use that:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hey. You can take a peek at our invisible implementation for some pointers: https://github.com/praekelt/django-recaptcha/blob/develop/captcha/templates/captcha/includes/js_v2_invisible.html Then you'd want to override the The onSubmit_{{ uuid }} methods you see is our default for the Google reCAPTCHA data attr |
Beta Was this translation helpful? Give feedback.
-
I tried that, but it didn't work. Any idea what's wrong in my override attempt? I tried creating a 'includes' folder in my 'captcha' folder as well. |
Beta Was this translation helpful? Give feedback.
-
Would it be safe to set a variable to true in callback, when captcha is passed, or is there a safer way?
|
Beta Was this translation helpful? Give feedback.
-
Also, my template is not overriding the original one. project structure
settings.py
|
Beta Was this translation helpful? Give feedback.
Hey. You can take a peek at our invisible implementation for some pointers: https://github.com/praekelt/django-recaptcha/blob/develop/captcha/templates/captcha/includes/js_v2_invisible.html
Then you'd want to override the
includes/js_v2_checkbox.html
template with a custom implementation for your project. To override the templates check out the django docs on template overrides: https://docs.djangoproject.com/en/2.2/howto/overriding-templates/The onSubmit_{{ uuid }} methods you see is our default for the Google reCAPTCHA data attr
data-callback
. For more info on what to expect with the callback method, look at the Documentation for reCAPTCHA v2 : https://developers.google.com/recaptcha/d…