Skip to content

Commit 055aeca

Browse files
committed
Add settings option for reCAPTCHA proxies
1 parent a7fceed commit 055aeca

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ And add your reCaptcha private and public key to your django settings.py:
3232
```python
3333
RECAPTCHA_PRIVATE_KEY = 'your private key'
3434
RECAPTCHA_PUBLIC_KEY = 'your public key'
35+
# If you require reCaptcha to be loaded from somewhere other than https://google.com
36+
# (e.g. to bypass firewall restrictions), you can specify what proxy to use.
37+
# RECAPTCHA_PROXY_HOST = 'https://recaptcha.net'
3538
```
3639

3740
If you have to create the apikey for the domains managed by your django project, you can visit this <a href="https://www.google.com/recaptcha/admin">website</a>.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<script src="https://www.google.com/recaptcha/api.js{% if explicit %}?onload=djangoRecaptchaOnLoadCallback&render=explicit{% if language %}&hl={{ language }}{% endif %}{% elif language %}?hl={{ language }}{% endif %}" async defer></script>
1+
<script src="{{ recaptcha_host }}/recaptcha/api.js{% if explicit %}?onload=djangoRecaptchaOnLoadCallback&render=explicit{% if language %}&hl={{ language }}{% endif %}{% elif language %}?hl={{ language }}{% endif %}" async defer></script>

snowpenguin/django/recaptcha2/templatetags/recaptcha2.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def recaptcha_invisible_button(public_key=None, submit_label=None, extra_css_cla
3535
return {
3636
'generated_id': generated_id,
3737
'public_key': public_key or settings.RECAPTCHA_PUBLIC_KEY,
38+
'recaptcha_host': getattr(settings, 'RECAPTCHA_PROXY_HOST', 'https://google.com'),
3839
'form_id': form_id,
3940
'submit_label': submit_label or _('Submit'),
4041
'extra_css_classes': extra_css_classes,

0 commit comments

Comments
 (0)