Skip to content
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

Adding a User in either Volto/ClassicUI containing euro-sign fails #4125

Open
jensens opened this issue Feb 18, 2025 · 5 comments
Open

Adding a User in either Volto/ClassicUI containing euro-sign fails #4125

jensens opened this issue Feb 18, 2025 · 5 comments

Comments

@jensens
Copy link
Member

jensens commented Feb 18, 2025

I tried this on demo.plone.org.
Login as admin
Go to the control-panel , then users.
Add a new users.
In the popover form add some data and use foobarbaz€ as password.
Save the user.
Next you will get an cryptic error latin-1:

Image

Further tests need to follow. We did not check this in ClassicUI so far. If this is a problem there too, I can move the ticket to CMFPlone.
Could be also in PlonePAS or further down in the rabbit hole.

@rohnsha0
Copy link
Contributor

rohnsha0 commented Feb 25, 2025

same is the issue in Classic UI, but the error is a bit more descriptive

Image

traceback:
ERROR   [root:429][waitress-0] 'latin-1' codec can't encode character '\u20ac' in position 9: ordinal not in range(256)
Traceback (most recent call last):
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/plone.app.users-3.1.0-py3.11.egg/plone/app/users/browser/register.py", line 427, in handle_join_success
    registration.addMember(user_id, password, REQUEST=self.request)
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.CMFCore-3.6-py3.11.egg/Products/CMFCore/RegistrationTool.py", line 161, in addMember
    mtool.addMember(id, password, roles, domains, properties)
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.PlonePAS-8.0.5-py3.11.egg/Products/PlonePAS/tools/membership.py", line 140, in addMember
    acl_users._doAddUser(id, password, roles, domains)
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.PlonePAS-8.0.5-py3.11.egg/Products/PlonePAS/pas.py", line 92, in _doAddUser
    retval = _old_doAddUser(login, password, roles, domains)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.PluggableAuthService-3.0-py3.11.egg/Products/PluggableAuthService/PluggableAuthService.py", line 915, in _doAddUser
    if useradder.doAddUser(login, password):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.PluggableAuthService-3.0-py3.11.egg/Products/PluggableAuthService/plugins/ZODBUserManager.py", line 221, in doAddUser
    self.addUser(login, login, password)
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/Products.PlonePAS-8.0.5-py3.11.egg/Products/PlonePAS/plugins/user.py", line 63, in addUser
    if not AuthEncoding.is_encrypted(password):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/AuthEncoding-5.0-py3.11.egg/AuthEncoding/AuthEncoding.py", line 286, in is_encrypted
    pw = b(pw)
         ^^^^^
  File "/home/rohnsha0/code/plone/buildout.coredev/eggs/AuthEncoding-5.0-py3.11.egg/AuthEncoding/compat.py", line 4, in b
    arg = arg.encode("latin-1")
          ^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 9: ordinal not in range(256)

@jensens jensens transferred this issue from plone/volto Feb 25, 2025
@rohnsha0
Copy link
Contributor

problem lies at AuthEncoding/compat.py file as it uses latin-1 to encode the string, using utf-8 works simply fine...
https://github.com/zopefoundation/AuthEncoding/blob/c4deec01ec19e86cd7e3db7133a5b4474e661589/src/AuthEncoding/compat.py#L4
need to make a PR there.

@jensens
Copy link
Member Author

jensens commented Feb 25, 2025

I created an issue over there zopefoundation/AuthEncoding#17

@jensens jensens changed the title Adding a User in Volto containing euro-sign fails Adding a User in either Volto/ClassicUI containing euro-sign fails Feb 25, 2025
@jensens
Copy link
Member Author

jensens commented Feb 26, 2025

This was fixed upstream!
Let's wait closing this here until there is a new Zope and then Plone release containing the fix.

@jensens
Copy link
Member Author

jensens commented Feb 26, 2025

Info: AuthEncoding 6.0 was released and is part of Zope master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants