Skip to content

Only send mail from contact-info on POST requests. - #4361

Merged
erral merged 1 commit into
6.2.xfrom
maurits-issue-4360-contact-info-62
Aug 6, 2026
Merged

Only send mail from contact-info on POST requests.#4361
erral merged 1 commit into
6.2.xfrom
maurits-issue-4360-contact-info-62

Conversation

@mauritsvanrees

Copy link
Copy Markdown
Member

See #4360

@mister-roboto

Copy link
Copy Markdown

@mauritsvanrees thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@mauritsvanrees

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

@erral
erral self-requested a review July 31, 2026 18:07

@erral erral left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use plone.protect for this?

It has decorators or authenticators for this kind of protections. And we would be eating our own dog food, right?

@erral

erral commented Aug 1, 2026

Copy link
Copy Markdown
Member

Or better even, don't z3c.form forms have a method = 'post' attribute than force them to be a POST?

@mauritsvanrees

Copy link
Copy Markdown
Member Author

plone.protect has postOnly, see the readme. But using it as a decorator only works when the function has a REQUEST parameter.

We could directly pass the request to this function:

from plone.protect import PostOnly
PostOnly(self.request)

I am fine with allowing the GET request and simply ignoring the query parameters, as in my PR. But there is something to be said for denying it with postOnly.

I don't see anything in z3c.form for this. At least: searching for self.method finds nothing, and even searching for POST or GET. Ah, there is an interface with a field method, but I don't see any code reading this.

@erral
erral self-requested a review August 6, 2026 20:03
@erral
erral merged commit 4e6b2fd into 6.2.x Aug 6, 2026
6 checks passed
@erral
erral deleted the maurits-issue-4360-contact-info-62 branch August 6, 2026 20:03
mister-roboto pushed a commit to plone/buildout.coredev that referenced this pull request Aug 11, 2026
Branch: refs/heads/master
Date: 2026-08-10T11:36:44+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/Products.CMFPlone@696345b

Only send mail from contact-info on POST requests.

See plone/Products.CMFPlone#4360

Forward port of plone/Products.CMFPlone#4361

Files changed:
A news/4360.bugfix.md
M src/Products/CMFPlone/browser/contact_info.py
M src/Products/CMFPlone/tests/mails.txt
Repository: Products.CMFPlone

Branch: refs/heads/master
Date: 2026-08-11T22:55:51+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@py76.be>
Commit: plone/Products.CMFPlone@6112ee3

Merge pull request #4364 from plone/maurits-issue-4360-contact-info-63

Only send mail from contact-info on POST requests.

Files changed:
A news/4360.bugfix.md
M src/Products/CMFPlone/browser/contact_info.py
M src/Products/CMFPlone/tests/mails.txt
pull Bot pushed a commit to AKJUS/Products.CMFPlone that referenced this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants