-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Updating user fails with error 400 "Email is already taken" #2446
Comments
Hello @pwkrz can you precise your steps (body of your request) I'm able to update the email of one of my user. |
Hi @lauriejim , I have Strapi 3.0.0-alpha.16 installed globally and I created a project using Using the global admin account I send a PUT request to
And I get the response If I change the route configuration in If you need more info, please let me know! |
I have stumbled into this problem too. If you try to update an user but you are not going to change the email of this user, if the email is in the body of the PUT request. Obviously it should not fail but as a temporary fix try not including the email in the body of the request if you aren't changing it. |
As regards this issue, I discovered that the error was as a result of a mandatory As a quick fix, I performed a manual POST request (curl/fetch/etc), while including the TO REPRODUCE THIS ERROR:
|
Informations
What is the current behavior?
Updating a user model fails with error 400 "Email is already taken".
Steps to reproduce the problem
Send PUT request to /users/:_id when logged in as global Strapi admin.
What is the expected behavior?
The user object with the matching ID should be correctly updated and the server should return a 200 response.
Suggested solutions
It looks like the in the route configuration for User.update the
_id
param is used (line 250 of <project>\plugins\users-permissions\config\routes.json):but the handler checks for
id
(without underscore) inctx.params
, eg. over here (line 123 of <project>\plugins\users-permissions\controllers\User.js):Possible solution - either change path configuration to '/users/:id' or check for '_id' in ctx.params
The text was updated successfully, but these errors were encountered: