Fix Login

This commit is contained in:
RMartinOscar 2025-04-25 14:50:32 +00:00
parent bfb29f8109
commit 2d9514b3e6
4 changed files with 11 additions and 15 deletions

View File

@ -12,6 +12,7 @@ use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Schema;
use Filament\Support\Colors\Color;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Sleep;
@ -80,9 +81,9 @@ class Login extends \Filament\Auth\Pages\Login
return parent::authenticate();
}
protected function getForms(): array
public function form(Schema $schema): Schema
{
$schema = [
$components = [
$this->getLoginFormComponent(),
$this->getPasswordFormComponent(),
$this->getRememberFormComponent(),
@ -91,16 +92,11 @@ class Login extends \Filament\Auth\Pages\Login
];
if ($captchaProvider = $this->getCaptchaComponent()) {
$schema = array_merge($schema, [$captchaProvider]);
$components = array_merge($components, [$captchaProvider]);
}
return [
'form' => $this->form(
$this->makeForm()
->schema($schema)
->statePath('data'),
),
];
return $schema
->components($components);
}
private function getTwoFactorAuthenticationComponent(): Component
@ -164,10 +160,10 @@ class Login extends \Filament\Auth\Pages\Login
protected function getCredentialsFromFormData(array $data): array
{
$loginType = filter_var($data['email'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
$loginType = filter_var($data['login'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
return [
$loginType => mb_strtolower($data['email']),
$loginType => mb_strtolower($data['login']),
'password' => $data['password'],
];
}

View File

@ -39,7 +39,7 @@ class AdminPanelProvider extends PanelProvider
->favicon(config('app.favicon', '/pelican.ico'))
->topNavigation(config('panel.filament.top-navigation', false))
->maxContentWidth(config('panel.filament.display-width', 'screen-2xl'))
//->login(Login::class)
->login(Login::class)
->passwordReset()
->userMenuItems([
'profile' => Action::make('toProfile')

View File

@ -38,7 +38,7 @@ class AppPanelProvider extends PanelProvider
->maxContentWidth(config('panel.filament.display-width', 'screen-2xl'))
->navigation(false)
->profile(EditProfile::class, false)
//->login(Login::class)
->login(Login::class)
->passwordReset()
->userMenuItems([
Action::make('toAdmin')

View File

@ -43,7 +43,7 @@ class ServerPanelProvider extends PanelProvider
->favicon(config('app.favicon', '/pelican.ico'))
->topNavigation(config('panel.filament.top-navigation', false))
->maxContentWidth(config('panel.filament.display-width', 'screen-2xl'))
//->login(Login::class)
->login(Login::class)
->passwordReset()
->userMenuItems([
'profile' => Action::make('toProfile')