#240 Require Full Name During Sign-Up#248
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
b-at-neu
left a comment
There was a problem hiding this comment.
Code Review — Cycle 1 · needs revision
2 open — 1 🟠 Medium, 1 ⚪ Nit (see inline)
Revision — Cycle 1fixed R1-M1, R1-N1 · 67df4b7 |
b-at-neu
left a comment
There was a problem hiding this comment.
Code Review — Cycle 2 · approved
1 open — 1 ⚪ Nit (see inline)
Revision needed — move name collection to the login pageThe name gate should happen on the login page itself, not as a redirect to New approach
This way, right after OTP confirmation, the user's next page load hits Middleware change
Remove from the existing PR
Keep from the existing PR
UX
|
67df4b7 to
d69fb47
Compare
Revision — Cycle 2skipped R2-N1 (no change needed — follow-up: migrate |
b-at-neu
left a comment
There was a problem hiding this comment.
Code Review — Cycle 4 · needs revision
2 open — 1 🔴 Critical, 1 🟠 Medium (see inline)
bb69594 to
8e7ef0a
Compare
Revision — Cycle 4fixed R4-C1, R4-C2 · 8e7ef0a · rebase: app/login/page.tsx (took PR's conditional structure, incorporated dev's updated SIGN_IN_DESCRIPTION text) |
b-at-neu
left a comment
There was a problem hiding this comment.
Code Review — Cycle 4 · needs revision
2 open — 1 🔴 Critical, 1 🟠 Medium (see inline)
| } | ||
| /> | ||
| {user ? ( | ||
| <NameField defaultName={user.name ?? ''} redirectTo={safeTo} /> |
There was a problem hiding this comment.
R4-C1 🔴 Critical — The name gate is broken end-to-end. NameField only appears here when an already-authenticated nameless user explicitly visits /login again. But a brand-new user completing OTP via AuthView is redirected by the Neon SDK directly to redirectTo={safeTo} — they never land back on /login to see this form. The auth layout (app/(main)/(auth)/layout.tsx) no longer checks user.name (removed in a prior cycle), so that authenticated-nameless user arrives at their destination route with no gate. The acceptance criterion "Visiting any other authenticated route before setting a name redirects to /profile" is not met.
Fix: the login-page name form is the right home for name collection, but it cannot be the only enforcement point. The auth layout gate must be restored: add if (!user.name?.trim()) redirect('/login'); as the first check after getCurrentUser() in app/(main)/(auth)/layout.tsx, before the admin/manager early-returns. This catches every route under (auth) including post-OTP landings and direct navigation. The layout redirect sends nameless users to /login where this form then handles them — completing the loop correctly.
| 'Name saved, but account sync failed. Reload if issues persist.', | ||
| ); | ||
| else toast.success('Name saved'); | ||
|
|
There was a problem hiding this comment.
R4-C2 🟠 Medium — router.replace('/') is hardcoded. When a user arrives at /login?redirectTo=/positions/xyz/apply, the login page computes safeTo = '/positions/xyz/apply' and passes it to AuthView. An authenticated-nameless user seeing NameField should be sent to that same safeTo after submitting — but this hardcodes / (which resolves to /positions via the root redirect). Fix: add a redirectTo: string prop to NameField and pass safeTo from the login page: <NameField defaultName={user.name ?? ''} redirectTo={safeTo} />. Use that prop in router.replace(redirectTo) so post-name navigation honors the original destination.
b-at-neu
left a comment
There was a problem hiding this comment.
Code Review — Cycle 5 · approved
0 open — R4-C1 (Critical) and R4-C2 (Medium) both resolved; no regressions introduced
on /profile with a NameField client component, and sync to the Neon Auth account after the server action writes the app User row. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
/login when a session has no name, redirect named users to the app,
remove the name gate from the auth layout and NameField from /profile.
Router.replace('/') on success so the user lands in the app directly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restore name gate in auth layout so every authenticated-nameless user is redirected to /login regardless of entry point. Add redirectTo prop to NameField so post-name navigation honors the original destination. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8e7ef0a to
a1bd619
Compare
Revision — Cycle 4rebase: app/login/page.tsx (accepted both sides — HEAD added |
Closes #240
Summary
user.namebeing set — all roles (applicant, manager, admin) must provide a name before accessing the app/profilefor users without a name; card disappears after submitUserrow (server action, the gate-clearing source of truth) and the Neon Auth account (client-sideauthClient.updateUser)Changes
lib/constants.ts— addNAME_MAX_LENGTH = 100, shared between the server action and client form schemaprisma/actions/profile.ts— addsetUserName(input: unknown)server action: auth viagetCurrentUser(), zod-validated, scoped write to caller'suser.id, revalidates/profileand layoutcomponents/features/name-field.tsx— new'use client'component: react-hook-form + zod, callssetUserNamethenauthClient.updateUser({ name }), toasts on success/error,router.refresh()to clear the gateapp/(main)/(auth)/layout.tsx— universal name gate:if (!user.name?.trim()) redirect('/profile')before any role-specific logicapp/(main)/profile/page.tsx— conditionally render<NameField />above<ProfileForm />when!user.name?.trim()app/(main)/profile/loading.tsx— add name-card skeleton at the top to avoid layout shiftTesting plan
/profilewith the Name card shown/) before setting a name redirects to/profile/profileafter setting a name — Name card is no longer shown/profileshows no Name card; no redirect loop/profileuntil name is set/profileuntil name is setAutomated checks
npm run tsc:check— cleannpm run eslint:check— cleannpm run prettier:check— cleanNotes
User.name String?already existsUser.namewrite (server action) is the gate-clearing source of truth;authClient.updateUsersyncs the Neon Auth account but a failure there only generates a non-blocking warning toast — the gate still clears!user.name?.trim()) is identical in both the layout gate and the profile page conditional to prevent any loop scenario