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>
64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
final class VolunteerRegistrationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$user = auth('sanctum')->user();
|
|
|
|
if ($user) {
|
|
$this->merge([
|
|
'first_name' => $user->first_name,
|
|
'last_name' => $user->last_name,
|
|
'email' => $user->email,
|
|
'_authenticated' => true,
|
|
]);
|
|
}
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
$user = auth('sanctum')->user();
|
|
|
|
$rules = [
|
|
'first_name' => ['required_without:_authenticated', 'string', 'max:255'],
|
|
'last_name' => ['required_without:_authenticated', 'string', 'max:255'],
|
|
'email' => ['required_without:_authenticated', 'email', 'max:255'],
|
|
'phone' => ['nullable', 'string', 'max:50'],
|
|
'date_of_birth' => ['nullable', 'date', 'before:today'],
|
|
|
|
'tshirt_size' => ['nullable', 'string', 'in:XS,S,M,L,XL,XXL,XXXL'],
|
|
'first_aid' => ['nullable', 'boolean'],
|
|
'allergies' => ['nullable', 'string', 'max:500'],
|
|
'driving_licence' => ['nullable', 'boolean'],
|
|
|
|
'motivation' => ['nullable', 'string', 'max:1000'],
|
|
'motivation_other' => ['nullable', 'string', 'max:500'],
|
|
|
|
'section_preferences' => ['nullable', 'array', 'max:5'],
|
|
'section_preferences.*.festival_section_id' => ['required', 'ulid'],
|
|
'section_preferences.*.priority' => ['required', 'integer', 'min:1', 'max:5'],
|
|
|
|
'availabilities' => ['nullable', 'array'],
|
|
'availabilities.*.time_slot_id' => ['required', 'ulid', 'exists:time_slots,id'],
|
|
'availabilities.*.preference_level' => ['nullable', 'integer', 'min:1', 'max:5'],
|
|
|
|
'field_values' => ['nullable', 'array'],
|
|
];
|
|
|
|
return $rules;
|
|
}
|
|
}
|