feat: integrate login/registration into PurchaseWizard
This commit is contained in:
@@ -7,7 +7,8 @@ use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Auth\Pages\Login as BaseLogin;
|
||||
use Filament\Auth\Http\Responses\Contracts\LoginResponse;
|
||||
use Filament\Auth\Http\Responses\LoginResponse;
|
||||
use Filament\Auth\Http\Responses\Contracts\LoginResponse as LoginResponseContract;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
@@ -15,7 +16,7 @@ class Login extends BaseLogin implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
public function authenticate(): ?LoginResponse
|
||||
public function authenticate(): ?LoginResponseContract
|
||||
{
|
||||
$data = $this->form->getState();
|
||||
|
||||
@@ -38,7 +39,7 @@ class Login extends BaseLogin implements HasForms
|
||||
}
|
||||
|
||||
// SuperAdmin-spezifisch: Prüfe auf SuperAdmin-Rolle, keine Tenant-Prüfung
|
||||
if ($user->role !== 'superadmin') {
|
||||
if ($user->role !== 'super_admin') {
|
||||
Auth::logout();
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
@@ -48,14 +49,19 @@ class Login extends BaseLogin implements HasForms
|
||||
|
||||
session()->regenerate();
|
||||
|
||||
return $this->getLoginResponse();
|
||||
return parent::getLoggedInResponse();
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return '/super-admin';
|
||||
}
|
||||
|
||||
protected function getCredentialsFromFormData(array $data): array
|
||||
{
|
||||
return [
|
||||
'email' => $data['email'],
|
||||
'password' => $data['password'],
|
||||
'email' => $data['data']['email'],
|
||||
'password' => $data['data']['password'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user