Add full name field for admin-created users; fix duplicate-email display#82
Merged
Merged
Conversation
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
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.
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 andAppUserCellrendered 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
User.fullName(nullable column + migration20260618000000_add_user_full_name) and collects it as a required field (min 2 chars) inadminCreateUserSchemaand the "Create User" modal./auth/me,/login) now exposefullName, so tables and the dashboard header show the real name.AppUserCellsuppresses the email subline when it would merely repeat the heading, fixing the duplicated email for any nameless legacy user too.emailVerifiedis true they are locked for everyone. Enforced server-side inPATCH /api/admin/users/[id](409) and self-servicePATCH /api/account/contact, and reflected in the detail-page form (fields become read-only with a note). Phone stays editable.adminCreateUserSchema/adminUpdateUserSchemaunit 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)prisma generateconfirms the field. No live DB in CI sandbox — integration tests (separate config) and the end-to-end click-through still need a real database vianpm run db:migrate+npm run dev.🤖 Generated with Claude Code
Generated by Claude Code