plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
240 stars 183 forks source link

fixed Registration tool email field to accept + in email #3971

Closed rohnsha0 closed 3 weeks ago

mister-roboto commented 3 weeks ago

@rohnsha0 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!

rohnsha0 commented 3 weeks ago

@mauritsvanrees @jensens pleasse check if it breaks anything?

rohnsha0 commented 3 weeks ago

@jenkins-plone-org please run jobs

rohnsha0 commented 3 weeks ago

@jenkins-plone-org please run jobs

mauritsvanrees commented 3 weeks ago

Seems to work. Actually, I tried with for example userid maurits+1 and email address maurits+1@example.org.

I only saw one problem. The author page (/author/maurits+1) has a link to the search page with all content created by this author. See this line in author.pt.
Locally this links to:

http://localhost:8080/Plone/search?Creator=maurits+2

This gives no search results. Instead it should be:

http://localhost:8080/Plone/search?Creator=maurits%2B2

That is the same as for example the users control panel does. It links to this user information url:

http://localhost:8080/Plone/@@user-information?userid=maurits%2B2

That is done in this line:

https://github.com/plone/Products.CMFPlone/blob/f7a537773cae9c4b56f57e31ac02192a7ce35648/Products/CMFPlone/controlpanel/browser/usergroups_groupmembership.pt#L133

So we would need a similar makeQuery call on the author page.

mauritsvanrees commented 3 weeks ago

Note that you can also go to the portal_registration tool in the ZMI and then the Configure panel: http://localhost:8080/Plone/portal_registration/manage_editIDPattern There you can specify an alternative user id pattern:

Screenshot 2024-06-14 at 17 38 27

I tried it and it still works. So if you want this in your own site, you can simply change the pattern in the ZMI.

rohnsha0 commented 3 weeks ago

in below code this_user is groupMember but what to get in case of username previously in author.pt we have view/username... now? https://github.com/plone/Products.CMFPlone/blob/f7a537773cae9c4b56f57e31ac02192a7ce35648/Products/CMFPlone/controlpanel/browser/usergroups_groupmembership.pt#L133

mauritsvanrees commented 3 weeks ago

In author.pt it was:

Creator=${username}

So now it should be:

Creator=${view.makeQuery(username)}

makeQuery is defined here:

https://github.com/plone/Products.CMFPlone/blob/f7a537773cae9c4b56f57e31ac02192a7ce35648/Products/CMFPlone/controlpanel/browser/usergroups.py#L71-L72

So you would need to copy that method (and the import it needs) to the AuthorView class.

I think that should be it.

rohnsha0 commented 3 weeks ago

@mauritsvanrees kindly verify the changes

mauritsvanrees commented 3 weeks ago

Yes, now it is fine. Thanks!