Files
crewli/apps/portal/src/composables/api/useVolunteerRegistration.ts
bert.hausmans c4a23b6763 feat: passwordless registration — defer account creation to approval
Removes password from the volunteer registration form. Account
creation is now deferred to the approval step:

Backend:
- Registration creates Person without User (user_id=null)
- On approval, system finds or creates User by person.email
- New accounts get a "set password" email with activation link
- Existing accounts get a portal link email
- Added registration_source column to persons (self/organizer)
- Fuzzy name matching skipped for self-registered persons
- person.email is always source of truth for account linking

Frontend:
- Registration form no longer collects password
- Email check shows info alert with login suggestion
- New wachtwoord-instellen.vue page for account activation
- PasswordRequirements.vue component (reused on reset page)
- Success page updated with activation messaging

Tests: 837 passed (all updated for new flow)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 03:27:47 +02:00

41 lines
1.1 KiB
TypeScript

import { useQuery, useMutation } from '@tanstack/vue-query'
import type { Ref } from 'vue'
import { apiClient } from '@/lib/axios'
import type { EventRegistrationData, VolunteerRegistrationForm } from '@/types/registration'
interface ApiResponse<T> {
data: T
}
export function useRegistrationData(eventSlug: Ref<string>) {
return useQuery({
queryKey: ['registration-data', eventSlug],
queryFn: async () => {
const { data } = await apiClient.get<ApiResponse<EventRegistrationData>>(
`/public/events/${eventSlug.value}/registration-data`,
)
return data.data
},
enabled: () => !!eventSlug.value,
retry: false,
})
}
export interface VolunteerRegistrationResponse {
person: Record<string, unknown>
}
export function useSubmitRegistration() {
return useMutation({
mutationFn: async ({ eventId, form }: { eventId: string; form: VolunteerRegistrationForm }) => {
const { data } = await apiClient.post<ApiResponse<VolunteerRegistrationResponse>>(
`/events/${eventId}/volunteer-register`,
form,
)
return data.data
},
})
}