mcp-context-forge icon indicating copy to clipboard operation
mcp-context-forge copied to clipboard

[BUG]: API Call - Users - Can not create inactive users

Open IuliaGaitan opened this issue 10 months ago • 5 comments

🐞 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

  1. Go to Swagger or use curl
  2. 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
}
  1. Check results on GET to http://localhost:8000/auth/email/admin/users

Results

The is_active is saved as true. Example: Image

Image

POST auth/email/admin/users/{user_email}

Image

🤔 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

IuliaGaitan avatar Jan 27 '26 13:01 IuliaGaitan

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).

crivetimihai avatar Jan 30 '26 12:01 crivetimihai

Tested on local environment. @MohanLaksh could you please check? Thank you! Now we have 500 when trying to create an inactive user.

Image

IuliaGaitan avatar Feb 04 '26 13:02 IuliaGaitan

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!

Image

IuliaGaitan avatar Feb 06 '26 08:02 IuliaGaitan

Tested on local testing environment. The endpoint now showing 500 error with API Token generated on admin rights.

Image

IuliaGaitan avatar Feb 10 '26 08:02 IuliaGaitan

Tested on OCP2 QA environment. The problem is no longer present.

Image

IuliaGaitan avatar Feb 11 '26 11:02 IuliaGaitan