Mask email addresses in admin user list - #79
Conversation
Admin GET /users now returns masked emails (e.g. r***8@gmail.com).
A new GET /users/{id} endpoint returns the full email for admins.
The admin dashboard shows the masked address with a "reveal" button
that fetches the detail endpoint on demand, and the Edit flow also
fetches /users/{id} so the edit form always gets the real address.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65d08b0825
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const lowerU = username.toLowerCase(); | ||
|
|
||
| // exclude record being edited from duplicate checks | ||
| // username duplicate check (emails are masked in list, so email check is server-side) |
There was a problem hiding this comment.
Preserve case-insensitive duplicate email checks
Keep a case-insensitive duplicate check rather than relying solely on UserService.emailExists(): that method delegates to the case-sensitive existsByEmail, and PostgreSQL's ordinary text uniqueness is also case-sensitive. When alice@example.com already exists, the admin form can now create alice@EXAMPLE.COM, even though the removed client check treated those addresses as duplicates and both deliver to the same domain/mailbox.
Useful? React with 👍 / 👎.
| if (!u) return; | ||
| let u; | ||
| try { | ||
| u = await authFetch(`/users/${id}`, { method: 'GET' }); |
There was a problem hiding this comment.
Ignore stale edit-detail responses
Prevent an earlier edit request from overwriting a later selection. If an admin clicks Edit for user A and then user B before A's request completes, and B's response arrives first, A's later response repopulates the form and resets editingUserId to A; the next submission can therefore modify the wrong account. Track the latest requested ID, disable competing edits, or abort superseded requests before applying the response.
Useful? React with 👍 / 👎.
Guard against stale out-of-order fetch responses in the admin edit handler by tracking pendingEditId and discarding responses that arrive after a newer edit click. Fix case-insensitive email duplicate detection: add existsByEmailIgnoreCase to UserRepository, use it in UserService, and tighten the update guard to equalsIgnoreCase so casing variants are caught consistently at the server layer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
GET /usersnow returns masked emails (r***8@gmail.com) using the existingLoggingUtil.maskEmail()utilityGET /users/{id}admin-only endpoint returns the full user detail with unmasked email/users/{id}before populating the form so the email field always contains the real address