zsnake
zsnake
FFilament
Created by zsnake on 6/1/2024 in #❓┊help
Unable to find component: [app.filament.pages.auth.custom-login]
Livewire\Exceptions\ComponentNotFoundException Unable to find component: [app.filament.pages.auth.custom-login] this error happen when click sign in button its happen only when i replace default login with custom login CustomLogin.php
<?php

namespace App\Filament\Pages\Auth;

use Filament\Forms\Components\Component;
use Filament\Forms\Components\TextInput;
use Filament\Pages\Auth\Login;
use Illuminate\Validation\ValidationException;

class CustomLogin extends Login
{
protected function getForms(): array
{
return [
'form' => $this->form(
$this->makeForm()
->schema([
$this->getLoginFormComponent(),
$this->getPasswordFormComponent(),
$this->getRememberFormComponent(),
])
->statePath('data'),
),
];
}

protected function getLoginFormComponent(): Component
{
return TextInput::make('username')
->label('Username')
->required()
->autocomplete()
->autofocus()
->extraInputAttributes(['tabindex' => 1]);
}

protected function getCredentialsFromFormData(array $data): array
{
return [
'username' => $data['username'],
'password' => $data['password'],
];
}

protected function throwFailureValidationException(): never
{
throw ValidationException::withMessages([
'data.username' => __('filament-panels::pages/auth/login.messages.failed'),
]);
}
}
<?php

namespace App\Filament\Pages\Auth;

use Filament\Forms\Components\Component;
use Filament\Forms\Components\TextInput;
use Filament\Pages\Auth\Login;
use Illuminate\Validation\ValidationException;

class CustomLogin extends Login
{
protected function getForms(): array
{
return [
'form' => $this->form(
$this->makeForm()
->schema([
$this->getLoginFormComponent(),
$this->getPasswordFormComponent(),
$this->getRememberFormComponent(),
])
->statePath('data'),
),
];
}

protected function getLoginFormComponent(): Component
{
return TextInput::make('username')
->label('Username')
->required()
->autocomplete()
->autofocus()
->extraInputAttributes(['tabindex' => 1]);
}

protected function getCredentialsFromFormData(array $data): array
{
return [
'username' => $data['username'],
'password' => $data['password'],
];
}

protected function throwFailureValidationException(): never
{
throw ValidationException::withMessages([
'data.username' => __('filament-panels::pages/auth/login.messages.failed'),
]);
}
}
AdminPanelProvider.php
return $panel
->default()
->id('admin')
->path('admin')
->login(CustomLogin::class)
return $panel
->default()
->id('admin')
->path('admin')
->login(CustomLogin::class)
5 replies