49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Admin\Pages;
|
|
|
|
use Filament\Forms\Components\Component;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Pages\Auth\Login;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class UsernameLogin extends Login
|
|
{
|
|
protected function getEmailFormComponent(): Component
|
|
{
|
|
return TextInput::make('username')
|
|
->label('Username')
|
|
->required()
|
|
->autofocus()
|
|
->extraInputAttributes(['tabindex' => 1])
|
|
->autocomplete();
|
|
}
|
|
|
|
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'),
|
|
]);
|
|
}
|
|
|
|
public function getTitle(): Htmlable|string
|
|
{
|
|
return __('Login');
|
|
|
|
}
|
|
|
|
public function getHeading(): Htmlable|string
|
|
{
|
|
return __('Login');
|
|
}
|
|
}
|