django-recaptcha2 icon indicating copy to clipboard operation
django-recaptcha2 copied to clipboard

Load recaptcha script in the widget template

Open Lanny opened this issue 6 years ago • 1 comments

On pages where captcha display is conditional, in cases where no captcha is displayed, it would be nice to not load the captcha script. But if you're including {% recaptcha_init %} in a page's <head> tag you have to do the captcha check in two places. It would also make first time setup easier as you wouldn't need to edit any of your project templates to facilitate integration.

Lanny avatar Oct 20 '17 04:10 Lanny

{% recaptcha_init %} is only a helper to make simpler to include the google script in your project. Only the explicit init is more complicated. I didn't understand what you mean with "you have to do the captcha check in two places", but I agree with you that you need to know if a page needs to display a recaptcha to make the init conditional.

I'm investigating for find a way to add it automatically, buy my concerns are about how pass parameters to initialization, how to place the code in the right position (inside head) and how to detect if it is already included.

If you don't mind I mark this issue as enhancement.

kbytesys avatar Nov 10 '17 09:11 kbytesys