-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix #2064: Check catcha url exists in signup form #2470
Conversation
Coverage reportTotal coverage
Report generated by 🧪jest coverage report action from 08e1c4d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, only one little thing. And maybe it would be nice if it also deleted the field when the setting is just an empty string instead of nonexistent?
apps/contrib/templates/a4_candy_contrib/includes/form_field.html
Outdated
Show resolved
Hide resolved
fb17f5e
to
9da596d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m4ra had two comments to my commit, which are true: db29abc
And I remembered the wagtail forms, where we also use the captcha. That should also be included before merge. (See the end of the landing page of the dev-server and https://github.com/liqd/adhocracy-plus/blob/main/apps/cms/contacts/models.py)
So, I will just leave it for now, you can finish it in July or with the next a+ sprint.
apps/cms/contacts/models.py
Outdated
|
||
print("WagtailCaptchaFormBuilder FIELDS", list(fields)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooops, yes, i deleted it now.
Looking good! Only one print out left. We just introduced a CHANGELOG procedure, once you rebase this branch onto main, you should find a changelog folder there with a README. The plan is to add a file to that folder with every PR/commit, so maybe you could already add one in this PR? |
f6708b1
to
6e4f1a1
Compare
apps/cms/contacts/models.py
Outdated
), | ||
) | ||
# Add captcha to formfields property if the URL exists in settings | ||
if settings.CAPTCHA_URL: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the other file you use if not (hasattr(settings, "CAPTCHA_URL") and settings.CAPTCHA_URL):
but here only settings.CAPTCHA_URL:
is there a reason why we don't need hasattr
here ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is because here the field is added, and in the other form the field is deleted if setting not there. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I started working on this, there was no CAPTCHA_URL as default with an empty string, thus I did the check for the attribute. Katharina added that url as empty string in the base settings afterwards and while I was away. So technically we don't need the hasattr check any longer. But it can also be there as an extra safety. Let me know what you prefer and I will update either check to be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mara ah, makes sense. I'm fine with both, so pick what you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6e4f1a1
to
76dad5d
Compare
@mara Not sure if you saw this comment? |
76dad5d
to
08e1c4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
This PR fixes the error:
when no captcha is installed in the project and thus no CAPTCHA_URL in the settings.
#2064