Skip to content

Mask email addresses in admin user list - #79

Merged
enlorik merged 2 commits into
mainfrom
feature/mask-email-in-admin-list
Jul 30, 2026
Merged

Mask email addresses in admin user list#79
enlorik merged 2 commits into
mainfrom
feature/mask-email-in-admin-list

Conversation

@enlorik

@enlorik enlorik commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • GET /users now returns masked emails (r***8@gmail.com) using the existing LoggingUtil.maskEmail() utility
  • New GET /users/{id} admin-only endpoint returns the full user detail with unmasked email
  • Admin dashboard shows masked email in the table with a "reveal" button that fetches the detail endpoint on demand
  • Edit flow fetches /users/{id} before populating the form so the email field always contains the real address
  • Frontend username duplicate check is unchanged; email duplicate check is now server-side only (backend already returns 409 with an "email" error message that surfaces correctly in the UI)

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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' });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@enlorik

enlorik commented Jul 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 3bb6ab033f

ℹ️ 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".

@enlorik
enlorik merged commit 831bd9a into main Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant