Open sveetch opened 3 years ago
@barseghyanartur hi, what is your opinion about a fix for this ?
Since django-recaptcha==1.4.0 has dropped support for Django<=1.11 but fobi still support it. Also the old ReCaptcha widget has been renamed ReCaptchaV2Checkbox but there is also a new widget ReCaptchaV3 introduced in 2.0.0 but this seems out of scope for the fix which is only about V2.
What do you think ?
I think it's time to drop everything below Django 2.2.
If you have time to work on making recaptcha
plugin working again, either with V2 or V3 (if you think V3 is a better alternative), please branch from v0.16.x. I'll prepare deprecation/fix release in the meanwhile (0.17.x) and merge your changes in. OK?
Seems ok, first i did want to use the V3 but there seems to have some minor bugs for now, since V2 is solid enough i will focus on it so it's reliable. So i will look at this for next week, starting on 0.16.x for recaptcha 2.0.6 and V2.
BTW, are you aware of invisible_recaptcha? I liked that one all the most. :) It should, however, not stop us improving recaptcha
. :)
Yeah i now about the invisible one, but never used it yet. By the way it seems this one should work, from the recaptcha diff i don't see any incompatible changes.
@sveetch:
Could you test the v0.17.x branch? Recaptcha plugin is fixed there.
@sveetch:
Ping.
@barseghyanartur Sorry for the delay.
I've just tried with your last commit (b39344668cbb11aef5249644edb945c1a2b3c449) from branch https://github.com/barseghyanartur/django-fobi/tree/v0.17.x and it works well, not any error when creating new form with a recaptcha field, updating it and using the form in frontend.
Here is the environment for my tests:
Python==3.6.8
Django==2.2.17
django-fobi==0.16.4
django-recaptcha==2.0.6
django-cms==3.7.4
By the way, i wanted to test the invisible recaptcha as you talked before, with the same environment in a new form and it does not succeed to validate the captcha field, i got this error in my form when submiting everything correctly:
captcha: * Invisible reCAPTCHA validation error
As described from this plugin Readme i've added settings FOBI_PLUGIN_INVISIBLE_RECAPTCHA_SITE_**
. In my development environment i used the same recaptcha development keys:
RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
FOBI_PLUGIN_INVISIBLE_RECAPTCHA_SITE_KEY = RECAPTCHA_PUBLIC_KEY
FOBI_PLUGIN_INVISIBLE_RECAPTCHA_SITE_SECRET = RECAPTCHA_PRIVATE_KEY
And my frontend have jQuery v3.5.1 and did not see any Javascript error or Django error logs.
Also you got some warnings from Python about deprecated \s
escaping sequence in regex:
.envs/default/lib/python3.6/site-packages/fobi/base.py:1553
/home/emencia/projects/respiragora/.envs/default/lib/python3.6/site-packages/fobi/base.py:1553: DeprecationWarning: invalid escape sequence \s
initial = re.sub("{{\s+", "{{", initial)
.envs/default/lib/python3.6/site-packages/fobi/base.py:1554
/home/emencia/projects/respiragora/.envs/default/lib/python3.6/site-packages/fobi/base.py:1554: DeprecationWarning: invalid escape sequence \s
initial = re.sub("\s+}}", "}}", initial)
https://github.com/barseghyanartur/django-fobi/blob/master/src/fobi/base.py#L1553
However, feel free to close this issue if it's ok for you since original subject from this issue has been fixed.
@sveetch: The original issue is fixed in 0.17. Let this stay open for a while, until I check/fix your additional findings.
Bug Report
Expected behavior/code
fobi.contrib.plugins.form_elements.security.recaptcha
should be compatible with last django-recaptcha version.Actual Behavior django-recaptcha release 2.0.0 has made some breakward incompatible refactoring on widget:
https://github.com/praekelt/django-recaptcha/commit/0a46ba8a49169a7776ca85a722c646b5b64934c9#diff-038fe6799d7292706ae4b851dd2dd64165d8018e8610bb25452f3457d562774b
This leads to an error on this plugin which try to import the old widget name "ReCaptcha":
https://github.com/barseghyanartur/django-fobi/blob/master/src/fobi/contrib/plugins/form_elements/security/recaptcha/base.py#L24
Steps to Reproduce
Environment