Skip to content

Add full name field for admin-created users; fix duplicate-email display#82

Merged
judedanbo merged 1 commit into
mainfrom
claude/admin-user-full-name-field-5gxsnm
Jun 21, 2026
Merged

Add full name field for admin-created users; fix duplicate-email display#82
judedanbo merged 1 commit into
mainfrom
claude/admin-user-full-name-field-5gxsnm

Conversation

@judedanbo

Copy link
Copy Markdown
Owner

Summary

Admin user creation previously collected only an email, so staff users had no name stored anywhere. As a result the admin user table (/admin/users) and user show page (/admin/users/[id]) fell back to the email for the display name and AppUserCell rendered it as both the heading and the email subline — the email appeared twice for every staff user.

This PR adds a full-name field and fixes that display.

Changes

  • Full name on creation — adds User.fullName (nullable column + migration 20260618000000_add_user_full_name) and collects it as a required field (min 2 chars) in adminCreateUserSchema and the "Create User" modal.
  • Display fix — the user list, detail page, and auth responses (/auth/me, /login) now expose fullName, so tables and the dashboard header show the real name. AppUserCell suppresses the email subline when it would merely repeat the heading, fixing the duplicated email for any nameless legacy user too.
  • Immutability rule — email and full name are editable only while the invite is pending; once emailVerified is true they are locked for everyone. Enforced server-side in PATCH /api/admin/users/[id] (409) and self-service PATCH /api/account/contact, and reflected in the detail-page form (fields become read-only with a note). Phone stays editable.
  • Seeds — seeded/demo staff users now get real names.
  • TestsadminCreateUserSchema/adminUpdateUserSchema unit tests updated and extended; integration tests cover full-name persistence and the verified-lock behaviour.

Behavior change to flag

Locking email after verification also blocks the existing self-service "change my email" flow (account/contact.patch.ts), which previously let a verified user change their email (re-triggering verification). This was done per the requested rule that email/full name are immutable once verified.

Verification

  • npm run lint ✅, npx nuxi typecheck ✅ (no TS errors)
  • Unit suite 552/552 passing ✅ (incl. 22 admin-user-schema tests)
  • Migration written by hand and prisma generate confirms the field. No live DB in CI sandbox — integration tests (separate config) and the end-to-end click-through still need a real database via npm run db:migrate + npm run dev.

🤖 Generated with Claude Code


Generated by Claude Code

Admin user creation previously collected only an email, so staff users had
no name stored anywhere — the user table and detail page fell back to the
email and rendered it twice (heading + subline) via AppUserCell.

- Add User.fullName (nullable column + migration) and collect it (required,
  min 2 chars) on admin user creation.
- Surface fullName in the user list, detail, and auth (me/login) responses
  so the dashboard header and tables show the real name.
- Lock email + full name once the account's email is verified, for admins
  (PATCH /api/admin/users/[id]) and the user themselves (account contact);
  both remain editable only while the invite is pending.
- AppUserCell now suppresses the email subline when it merely repeats the
  heading, fixing the duplicated email for any nameless legacy user.
- Seed real names for seeded/demo staff users.
- Update + extend admin user schema and integration tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J9Cw3MHJqYqzL59e8x3Rw4
@judedanbo judedanbo merged commit 8b6ba33 into main Jun 21, 2026
1 check passed
@judedanbo judedanbo deleted the claude/admin-user-full-name-field-5gxsnm branch June 21, 2026 10:43
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.

2 participants