-
Notifications
You must be signed in to change notification settings - Fork 274
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not require a captcha when using the API #931
Conversation
This was trickier than expected, due to some side effects : when the captcha is set to `True` via configuration, it doesn't change the behavior directly of the ProjectForm class, but does so only when the project form is used in the `web.py` module. So, when just using the API (and not using the web.py module, for instance during tests — manual or functional), no problem was shown, and everything was working properly. But at soon as somebody sees the "/" endpoint, the captcha was required, by both the API and the `web.py` module. This fixes it by adding a way to bypass the captcha with a new `bypass_captcha` property on the form.
Wow, this is a good heisenbug! Maybe we should get rid of that |
Hmm, that's correct. I believe we should merge this and change the way we handle this captcha thing in another pull request. I opened a new bug for this. |
Actually, I changed the way things were implemented for the Captcha. It's a lot more clear this way, thanks @zorun for the review 👍 |
cf124fa
to
a043316
Compare
Great, thanks for the change, it looks good :) I think you just need to reformat |
a043316
to
856ced4
Compare
Prior to this commit, things were done by activating or deactivating a "captcha" property on the class on-the-fly, which caused side-effects. This is now using subclasses, which makes the code simpler to understand, and less prone to side-effects. Thanks @zorun for the idea.
856ced4
to
7072fb3
Compare
* Do not require a captcha when using the API This was trickier than expected, due to some side effects : when the captcha is set to `True` via configuration, it doesn't change the behavior directly of the ProjectForm class, but does so only when the project form is used in the `web.py` module. So, when just using the API (and not using the web.py module, for instance during tests — manual or functional), no problem was shown, and everything was working properly. But at soon as somebody sees the "/" endpoint, the captcha was required, by both the API and the `web.py` module. This fixes it by adding a way to bypass the captcha with a new `bypass_captcha` property on the form. Prior to this commit, things were done by activating or deactivating a "captcha" property on the class on-the-fly, which caused side-effects. This is now using subclasses, which makes the code simpler to understand, and less prone to side-effects. Thanks @zorun for the idea.
This was trickier than expected, due to some side effects : when the
captcha is set to
True
via configuration, it doesn't change thebehavior directly of the ProjectForm class, but does so only when the
project form is used in the
web.py
module.So, when just using the API (and not using the web.py module, for
instance during tests — manual or functional), no problem was shown,
and everything was working properly.
But at soon as somebody sees the "/" endpoint, the captcha was
required, by both the API and the
web.py
module.This fixes it by adding a way to bypass the captcha with a new
bypass_captcha
property on the form.