-
Notifications
You must be signed in to change notification settings - Fork 684
Closed
Description
What happened?
When saving a user profile via Ajax to the "save-user" endpoint, a status code 200 is returned when there are no errors. All good here.
However, the controller returns with a 400 status code if any field returns an error.
JSON data is returned in either event, so this behavior appears to be a bug.
Response from NON field error (200 status):
{
"id": 1,
"modelName": "user",
"user": {
.....
},
"message": "User saved."
}
Response with any field error (400 status):
{
"modelName": "user",
"user": {
.....
},
"errors": {
"currentPassword": [
"Incorrect current password."
],
"newPassword": [
"New Password should contain at least 6 characters."
]
},
"message": "Couldn’t save user."
}
My Ajax uses jQuery and a basic $.post(); method.
Please let me know if there's anything else I can provide.
Craft CMS version
4.9.6
PHP version
8.2.20
Operating system and version
Linux 6.1.0-18-amd64
Database type and version
MariaDB 10.11.8
Image driver and version
No response
Installed plugins and versions
CKEditor 3.8.3
Super Table 3.0.14
Reactions are currently unavailable