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

You can't add a user if email login is set in security #5951

Open
djay opened this issue Apr 9, 2024 · 6 comments
Open

You can't add a user if email login is set in security #5951

djay opened this issue Apr 9, 2024 · 6 comments
Labels
01 type: bug 30 needs: triage New issue that needs confirmation before work begins

Comments

@djay
Copy link
Member

djay commented Apr 9, 2024

Describe the bug
You can't add a user if email login is set in security settings

To Reproduce
Steps to reproduce the behavior:

  1. Set email login in control panel > security
  2. Add user
  3. if put the email in the user name field you will get an error saying it needs to be left blank. If you leave it blank you get an error that it's required.

Expected behavior
No login name field is displayed when adding a user and a user can be added

Screenshots
If applicable, add screenshots to help explain your problem.

Software (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Volto Version 16
  • Plone Version 6
  • Plone REST API Version [e.g. 7.0.1]

Additional context
Related issue is that the login dialog doesn't change to ask for email address instead of login name when login by email is turned on

@djay djay added 01 type: bug 30 needs: triage New issue that needs confirmation before work begins labels Apr 9, 2024
@djay
Copy link
Member Author

djay commented Apr 10, 2024

might get fixed as part of #5952 ?

@djay
Copy link
Member Author

djay commented Apr 10, 2024

A quick fix might be to remove the clientside validation on the username field if there is currently no easy way to know the security settings when that form is rendered?
OR quick serverside fix might be to allow a username that matches the email address.

@davisagli
Copy link
Sponsor Member

The form already fetches the usergroup control panel settings. I haven't looked at the details but I would guess it's not hard to make it also fetch the security settings.

@JeffersonBledsoe JeffersonBledsoe removed their assignment Apr 10, 2024
@wesleybl
Copy link
Member

Is this why the user name field does not have the required asterisk?

@wesleybl
Copy link
Member

if you leave it blank you get an error that it's required.

This shouldn't happen see: https://github.com/plone/plone.restapi/blob/5cf1418e928f143ef1b42fdc3e4ed72a3126e9dd/src/plone/restapi/services/users/add.py#L69-L71

What version of plone.restapi are you using?

@JeffersonBledsoe
Copy link
Member

It appears that this is mostly a Volto 16 issue, as in Volto 17 we use the userschema to display the fields where the username field isn't required so can be skipped over. I've included screenshots below showing the difference in an out-the-box Volto experience

Add user form in Volto 16

Add user form in Volto 17

However, it still isn't ideal that this field is display. I did look into adding the use_email_as_login option to the userschema, but I don't this makes sense as the userschema can be used elsewhere and the option isn't really linked to users. I think it would make sense to include the use_email_as_login as part of the @site endpoint as it's more of a global setting which could make sense to be used elsewhere (for example, in the Login form as mentioned in the issue description). This would also be a suitable place for the other public security settings like enable_self_reg.

@djay @davisagli Any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 type: bug 30 needs: triage New issue that needs confirmation before work begins
Projects
None yet
Development

No branches or pull requests

4 participants