fix: Add missing COPPA fields to registration payload
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

- Added dateOfBirth, parentalEmail, and coppaConsentGiven to RegisterData interface
- Updated register function to include all required COPPA compliance fields in API payload
- Added debug logging to see registration payload
- Fixed 400 error during registration due to missing required dateOfBirth field

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 15:23:02 +00:00
parent d81010ef91
commit 952efa6d37
3 changed files with 59 additions and 23 deletions

View File

@@ -28,6 +28,9 @@ export interface RegisterData {
password: string;
name: string;
role?: string;
dateOfBirth: string; // COPPA compliance - required
parentalEmail?: string; // For users 13-17
coppaConsentGiven?: boolean; // For users 13-17
}
interface AuthContextType {
@@ -144,13 +147,26 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
// Auto-detect timezone from user's device
const detectedTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const response = await apiClient.post('/api/v1/auth/register', {
const payload: any = {
email: data.email,
password: data.password,
name: data.name,
timezone: detectedTimezone || 'UTC',
dateOfBirth: data.dateOfBirth,
deviceInfo,
});
};
// Add optional COPPA fields if provided
if (data.parentalEmail) {
payload.parentalEmail = data.parentalEmail;
}
if (data.coppaConsentGiven !== undefined) {
payload.coppaConsentGiven = data.coppaConsentGiven;
}
console.log('[Auth] Registration payload:', JSON.stringify(payload, null, 2));
const response = await apiClient.post('/api/v1/auth/register', payload);
// Backend returns { success, data: { user, family, tokens } }
const { data: responseData } = response.data;