- Brand/Theming: Marketing-Farb- und Typographievariablen in `resources/css/app.css` eingeführt, AdminLayout, Dashboardkarten und Onboarding-Komponenten entsprechend angepasst; Dokumentation (`docs/todo/tenant-admin-onboarding-fusion.md`, `docs/changes/...`) aktualisiert. - Checkout & Payments: Checkout-, PayPal-Controller und Tests für integrierte Stripe/PayPal-Flows sowie Paket-Billing-Abläufe überarbeitet; neue PayPal SDK-Factory und Admin-API-Helper (`resources/js/admin/api.ts`) schaffen Grundlage für Billing/Members/Tasks-Seiten. - DX & Tests: Neue Playwright/E2E-Struktur (docs/testing/e2e.md, `tests/e2e/tenant-onboarding-flow.test.ts`, Utilities), E2E-Tenant-Seeder und zusätzliche Übersetzungen/Factories zur Unterstützung der neuen Flows. - Marketing-Kommunikation: Automatische Kontakt-Bestätigungsmail (`ContactConfirmation` + Blade-Template) implementiert; Guest-PWA unter `/event` erreichbar. - Nebensitzung: Blogsystem gefixt und umfassenden BlogPostSeeder für Beispielinhalte angelegt.
93 lines
2.5 KiB
PHP
93 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages\Auth;
|
|
|
|
use Filament\Forms\Components\Checkbox;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Concerns\InteractsWithForms;
|
|
use Filament\Forms\Contracts\HasForms;
|
|
use Filament\Pages\SimplePage;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class Login extends SimplePage implements HasForms
|
|
{
|
|
use InteractsWithForms;
|
|
|
|
protected string $view = 'filament.pages.auth.login';
|
|
protected static ?string $title = 'Tenant Login';
|
|
|
|
public function getFormSchema(): array
|
|
{
|
|
return [
|
|
TextInput::make('data.username_or_email')
|
|
->label('Username or Email')
|
|
->required()
|
|
->autofocus(),
|
|
TextInput::make('data.password')
|
|
->password()
|
|
->required()
|
|
->extraAttributes(['tabindex' => 2]),
|
|
Checkbox::make('data.remember')
|
|
->label('Remember me'),
|
|
];
|
|
}
|
|
|
|
public function submit(): void
|
|
{
|
|
$data = $this->form->getState();
|
|
|
|
$credentials = $this->getCredentialsFromFormData($data);
|
|
|
|
if (! Auth::attempt($credentials, $data['remember'] ?? false)) {
|
|
throw ValidationException::withMessages([
|
|
'data.username_or_email' => __('auth.failed'),
|
|
]);
|
|
}
|
|
|
|
$user = Auth::user();
|
|
|
|
if (! $user->email_verified_at) {
|
|
Auth::logout();
|
|
|
|
throw ValidationException::withMessages([
|
|
'data.username_or_email' => 'Your email address is not verified. Please check your email for a verification link.',
|
|
]);
|
|
}
|
|
|
|
if (! $user->tenant) {
|
|
Auth::logout();
|
|
|
|
throw ValidationException::withMessages([
|
|
'data.username_or_email' => 'No tenant associated with your account. Contact support.',
|
|
]);
|
|
}
|
|
|
|
session()->regenerate();
|
|
|
|
$this->redirect($this->getRedirectUrl());
|
|
}
|
|
|
|
protected function getCredentialsFromFormData(array $data): array
|
|
{
|
|
$usernameOrEmail = $data['username_or_email'];
|
|
$password = $data['password'];
|
|
|
|
$credentials = ['password' => $password];
|
|
|
|
if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
|
|
$credentials['email'] = $usernameOrEmail;
|
|
} else {
|
|
$credentials['username'] = $usernameOrEmail;
|
|
}
|
|
|
|
return $credentials;
|
|
}
|
|
|
|
public function hasLogo(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|