[BUG]: UI/ API - Edit user is not working
🐞 Bug Summary
Tested on local and OCP2 QA environment. The Update Password option from Ui or API call is not working. An Admin can not update any field on user as name, password or others.
🧩 Affected Component
Select the area of the project impacted:
- [X]
mcpgateway- API - [X]
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 https://ocp2.cloud.boomerangplatform.net/qa/mcp-gateway/service/gateway/admin/#users or local or use PUT on /auth/email/admin/users/{user_email}
- Try to use the Change Password option or on API add a new password
- ..Click Update or Execute
🤔 Results
The password is not updated.
Update user option should update the user password, user full name, if is admin or not. PUT endpoint should also update the password if the token is an Admin one
📓 Logs / Error Output
Paste any relevant stack traces or logs here. ⚠️ Do not paste secrets, credentials, or tokens.
🧠 Environment Info
| 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 |
You can retrieve most of this from the /version endpoint.
🧩 Additional Context (optional)
Related to #2390
Thank you for the report.
Confirmed: The PUT /auth/email/admin/users/{user_email} endpoint uses EmailRegistrationRequest which requires a password field (min 8 chars). This prevents partial updates where you only want to change full_name or is_admin.
Fix: Create a separate EmailUserUpdateRequest schema with all fields optional:
class EmailUserUpdateRequest(BaseModel):
password: Optional[str] = Field(None, min_length=8)
full_name: Optional[str] = Field(None, max_length=255)
is_admin: Optional[bool] = Field(None)
Then update the endpoint to use this schema and only update fields that are provided.
Tested on local environment on UI. Validation missing on UI on password update. (TC010 and TC012).
| Test Case Number | Edit Field | Expected Result | Actual Result | Pass/Fail |
|---|---|---|---|---|
| TC001 | Email edit | The email cand not be edited | ✅ Pass | |
| TC002 | Full Name | Full name updated successfully | Full name updated | ✅ Pass |
| TC003 | Full Name | Empty full name | Error: Full name required | ✅ Pass |
| TC004 | Administrator (On | Administrator status updated | Status updated | ✅ Pass |
| TC005 | Administrator (Off) | Administrator status updated | Error: Invalid input | ✅ Pass |
| TC006 | Change Password | Password changed successfully | Password changed | ✅ Pass |
| TC007 | Change Password | New password doesn't match confirm password | Error: Passwords do not match | ✅ Pass |
| TC008 | Full Name, Administrator (On/Off) | Full Name and admin status updated | Both updated | ✅ Pass |
| TC009 | Full Name, Change Password | Full name updated, password changed | Both updated | ✅ Pass |
| TC010 | Change Password | Weak password | Error: Password too weak | ❌ Fail |
| TC011 | Administrator (On/Off) | Toggle admin status multiple times | Status updated correctly each time | ✅ Pass |
| TC012 | Change Password - only 3 character | Minim 8 character | Error: Password too short | ❌ Fail |
| Summary | ||||
| Total: 12 | Passed: 10 ✅ | Failed: 2 ❌ |
@MohanLaksh could you please check? thank you!
Password Requirements are now shown, but Password Requirements is not validating the New Password and Confirm New Password and Update User is active even though the admin added for example only 3 characters. The validation should work as it does for Create a New User TC012 - ❌ Fail
- Edit User
- Add 123 tot New Password and Confirm New Password
- Check Update User Results - Update User button should be active only if Password Requirements are passed - example on Create New User functionality.
TC010 - Passed ✅ - now Password Requirements is shown.
Tested on local testing environment. The Update user is no longer working. All TC's are failed.
Tested on OCP2 QA environment. The problem is no longer present.