Invite new user: email with camel case error
Bug report
Required System information
- Node.js version: 16.15.0
- NPM version: 8.3.0
- Strapi version: 4.1.8
- Database: PosgreSQL
- Operating system: Window 10
Describe the bug
When creating a new admin user (invite new user), if the email has any capital letters, it does not submit the form or show errors. In Network (DevTools) it shows a 400 error.
Is there a sanitizer or something that does a toLowerCase to avoid this error?
Steps to reproduce the behavior
- Go to Settings / Users
- Click on "Invite new user"
- Fill the form with an email like "[email protected]"
- Click on "Invite user"
- You can repeat it with the network open.
Expected behavior
The form field automatically saves lower cases only.
Odd it should just be lowercasing it and not validating the input :thinking:
Odd it should just be lowercasing it and not validating the input 🤔
In standard scenarios, you are indeed lowercasing the email as per this line, but the defaultValidationParams are enforcing strict checks on the email, which apparently enforces lowercase() to only check that the string is in fact lowercase without transforming it beforehand according to Yup's documentation.
@derrickmehaffy do we need to make the change on the frontend on the form or the backend ?
All emails should be lowercase no matter the location so if you want to do the translation on the frontend that's fine, we also should be doing it on the backend.
Doesn't particularly matter if we force the user to type it that way or if we just convert it for them but we should pick something.