[BUG]: API Call - Users - Can not create inactive users
🐞 Bug Summary
Tested on local environment. Using POST http://localhost:8000/auth/email/admin/users with is_active:true in body is saving it to false. Same issue with trying to update the user using POST auth/email/admin/users/{user_email}
🧩 Affected Component
Select the area of the project impacted:
- [X]
mcpgateway- API - [ ]
mcpgateway- UI (admin panel) - [ ]
mcpgateway.wrapper- stdio wrapper - [ ] Federation or Transports
- [ ] CLI, Makefiles, or shell scripts
- [ ] Container setup (Docker/Podman/Compose)
- [ ] Other (explain below)
🔁 Steps to Reproduce
- Go to Swagger or use curl
- Make a POST to http://localhost:8000/auth/email/admin/users
curl -X 'POST' \
'http://localhost:8000/auth/email/admin/users' \
-H 'accept: application/json' \
-H 'Authorization: Bearer $ADMIN_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"password": "InactivePass123!",
"full_name": "[email protected]",
"is_admin": false,
"is_active": false,
"password_change_required" : false
}
- Check results on GET to http://localhost:8000/auth/email/admin/users
Results
The is_active is saved as true.
Example:
POST auth/email/admin/users/{user_email}
🤔 Expected Behavior
The is_active should be saved as false and the user should not be active and can not login to app.
📓 Logs / Error Output
Paste any relevant stack traces or logs here. ⚠️ Do not paste secrets, credentials, or tokens.
🧠 Environment Info
You can retrieve most of this from the /version endpoint.
| Key | Value |
|---|---|
| Version or commit | v0.128.0 |
| Runtime | Python 3.12.3 |
| Platform / OS | Linux 6.6.87.2-microsoft-standard-WSL2 (x86_64) |
| Container | none |
🧩 Additional Context (optional)
Related to #2390
Thank you for the report.
Confirmed: The EmailRegistrationRequest schema doesn't include is_active field. Values passed are silently ignored by Pydantic.
Fix: Add is_active: bool = Field(True) to EmailRegistrationRequest schema and wire it through the create_user endpoint.
Related to #2523 (same root cause - missing password_change_required field).
Tested on local environment. @MohanLaksh could you please check? Thank you! Now we have 500 when trying to create an inactive user.
Tested on local environment. 201 is shown in Swagger but the is_active is still true, not false. @MohanLaksh could you please check? Thank you!
Tested on local testing environment. The endpoint now showing 500 error with API Token generated on admin rights.
Tested on OCP2 QA environment. The problem is no longer present.