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

View File

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

View File

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

View File

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