improve user edit and list#258
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances user management by adding stricter client-side password feedback, expanding editable user role fields, and improving how user/contact relationships are displayed in tables (including backend support for exposing related contacts on users).
Changes:
- Added password issue detection (
getPasswordErrors) and inline validation feedback in the user form, plus new i18n strings (EN/ES). - Updated user edit flow/API payload to include
is_superuserandis_staff, and added role switches to the shared user form. - Exposed
contactson the backend user serializer and updated UI tables to display related contacts/users via badge components.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ngen/serializers/auth.py | Exposes related contacts on UserSerializer for UI consumption. |
| frontend/src/views/user/EditUser.jsx | Sends is_superuser / is_staff through the update API call. |
| frontend/src/views/user/components/TableUsers.jsx | Shows related contacts in the user table/modal via contact badges. |
| frontend/src/views/user/components/FormUser.jsx | Adds role switches and password error rendering in the shared user form. |
| frontend/src/views/user/components/BadgeUserLabel.jsx | New badge component to display a user label from a URL. |
| frontend/src/views/contact/components/TableContact.jsx | Adds a “User” column displaying the related user as a badge. |
| frontend/src/utils/validators/user.jsx | Introduces getPasswordErrors helper and exports it. |
| frontend/src/components/Field/YesNoField.jsx | Simplifies Yes/No display to a Bootstrap badge. |
| frontend/src/api/services/users.jsx | Extends putUser to include is_superuser / is_staff in payload. |
| frontend/public/locales/en/translation.json | Adds/updates translation strings for password errors and tooltips. |
| frontend/public/locales/es/translation.json | Adds/updates translation strings for password errors and tooltips. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and new features to user management and UI components, focusing on enhanced password validation, improved user role handling, and better display of related information in tables. The most significant changes include the addition of stricter password validation logic, updates to user forms and API calls to handle new user roles, and UI enhancements for displaying user and contact information.
Password validation and feedback:
getPasswordErrorsfunction inuser.jsxto check for common password issues (too short, entirely numeric, or too similar to personal info), and integrated this into the user form to provide real-time feedback using localized error messages. Updated translation files in English and Spanish to include these new messages. [1] [2] [3] [4] [5] [6]User role and status management:
FormUser.jsx) and API layer (users.jsx) to support editingis_superuserandis_stafffields, including new switches in the UI for these roles. Corresponding changes were made to ensure these fields are sent to and from the backend. [1] [2] [3] [4]Display of user and contact relationships:
BadgeUserLabelandBadgeNetworkLabelContact), replacing the previous yes/no field for network admin status with a more informative display of associated contacts. [1] [2] [3] [4]UI and translation improvements:
Backend serializer update:
UserSerializerto include acontactsfield, exposing related contacts in the API response for users. [1] [2]