auth: Selbst-Registrierungen nicht mehr als Legacy-Bestand einstufen

Die Register-Komponente setzte kein registration_type, wodurch der
DB-Default existing_legacy griff und jeder Neukunde im Admin als
Legacy-Bestand erschien. Jetzt wird explizit Company gesetzt —
konsistent mit dem CustomerAccountProvisioner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-15 13:11:53 +00:00
parent 700f5e6131
commit ce59cbbf4a
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,6 @@
<?php
use App\Enums\RegistrationType;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Support\Facades\Auth;
@ -51,6 +52,10 @@ new #[Layout('components.layouts.auth.pressekonto', ['heading' => 'Konto erstell
$validated['gdpr_consent_at'] = now();
$validated['password'] = Hash::make($validated['password']);
// Ohne expliziten Typ greift der DB-Default `existing_legacy` (für den
// Legacy-Import gedacht). Selbst-Registrierungen sind Neukunden —
// gleicher Default wie im CustomerAccountProvisioner.
$validated['registration_type'] = RegistrationType::Company->value;
// Konto bleibt bis zur E-Mail-Verifizierung inaktiv und rollenlos
// (Entscheidung 15.06.). Rolle + Aktivierung erfolgen erst nach dem
// bestätigten Verifizierungslink (ActivateUserAfterVerification).

View file

@ -1,5 +1,6 @@
<?php
use App\Enums\RegistrationType;
use App\Models\User;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Support\Facades\Notification;
@ -39,6 +40,9 @@ test('new users register inactive and are sent to the verification notice', func
// Die bestätigte AGB-/Datenschutz-Checkbox wird als Einwilligung festgehalten.
expect($user->gdpr_consent_at)->not->toBeNull();
// Selbst-Registrierungen sind Neukunden — nie der DB-Default `existing_legacy`.
expect($user->registration_type)->toBe(RegistrationType::Company);
Notification::assertSentTo($user, VerifyEmail::class);
});