From 7213075cde2e29eccf4f7a03a956b67ced91bcce Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 8 Oct 2025 11:56:00 +0000 Subject: [PATCH] feat: Add invite code field to registration form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend Changes: - Added inviteCode field to registration schema (optional) - Added invite code TextField to registration form UI - Updated RegisterData interface in AuthContext to include inviteCode - Pass inviteCode to backend during registration - Added helpful placeholder text indicating field is optional User Experience: - Invite code field appears after email in registration form - Helper text explains it's optional and can be left blank if registration is open - Backend will validate the code if REGISTRATION_MODE=invite_only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- maternal-web/app/(auth)/register/page.tsx | 23 +++++++++++++++++++++++ maternal-web/lib/auth/AuthContext.tsx | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/maternal-web/app/(auth)/register/page.tsx b/maternal-web/app/(auth)/register/page.tsx index 8ccdbf5..8c445d5 100644 --- a/maternal-web/app/(auth)/register/page.tsx +++ b/maternal-web/app/(auth)/register/page.tsx @@ -33,6 +33,7 @@ const registerSchema = z.object({ .regex(/[a-z]/, 'Password must contain at least one lowercase letter') .regex(/[0-9]/, 'Password must contain at least one number'), confirmPassword: z.string(), + inviteCode: z.string().optional(), dateOfBirth: z.string().min(1, 'Date of birth is required'), parentalEmail: z.string().email('Invalid email address').optional().or(z.literal('')), agreeToTerms: z.boolean().refine(val => val === true, { @@ -129,6 +130,7 @@ export default function RegisterPage() { name: data.name, email: data.email, password: data.password, + inviteCode: data.inviteCode || undefined, dateOfBirth: data.dateOfBirth, parentalEmail: data.parentalEmail || undefined, coppaConsentGiven: data.coppaConsent || false, @@ -242,6 +244,27 @@ export default function RegisterPage() { }} /> + + { deviceInfo, }; + // Add optional invite code if provided + if (data.inviteCode) { + payload.inviteCode = data.inviteCode; + } + // Add optional COPPA fields if provided if (data.parentalEmail) { payload.parentalEmail = data.parentalEmail;