You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More refactored 🆙
This commit is contained in:
@@ -14,7 +14,7 @@ use Illuminate\Validation\ValidationException;
|
||||
|
||||
class Login extends \Filament\Auth\Pages\Login
|
||||
{
|
||||
public $username = '';
|
||||
public string $username = '';
|
||||
|
||||
#[\Override]
|
||||
public function authenticate(): ?LoginResponse
|
||||
@@ -22,15 +22,23 @@ class Login extends \Filament\Auth\Pages\Login
|
||||
try {
|
||||
$this->rateLimit(5);
|
||||
} catch (TooManyRequestsException $exception) {
|
||||
$seconds = is_numeric($exception->secondsUntilAvailable) ? (int) $exception->secondsUntilAvailable : 0;
|
||||
$minutes = ceil($seconds / 60);
|
||||
$body = null;
|
||||
$throttled = __('filament-panels::pages/auth/login.notifications.throttled');
|
||||
if (is_array($throttled)) {
|
||||
$bodyText = __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
||||
'seconds' => $seconds,
|
||||
'minutes' => $minutes,
|
||||
]);
|
||||
$body = is_string($bodyText) ? $bodyText : null;
|
||||
}
|
||||
Notification::make()
|
||||
->title(__('filament-panels::pages/auth/login.notifications.throttled.title', [
|
||||
'seconds' => $exception->secondsUntilAvailable,
|
||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
||||
'seconds' => $seconds,
|
||||
'minutes' => $minutes,
|
||||
]))
|
||||
->body(array_key_exists('body', __('filament-panels::pages/auth/login.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
||||
'seconds' => $exception->secondsUntilAvailable,
|
||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
||||
]) : null)
|
||||
->body($body)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
@@ -39,7 +47,7 @@ class Login extends \Filament\Auth\Pages\Login
|
||||
|
||||
$data = $this->form->getState();
|
||||
|
||||
if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), $data['remember'] ?? false)) {
|
||||
if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), (bool) ($data['remember'] ?? false))) {
|
||||
$this->throwFailureValidationException();
|
||||
}
|
||||
|
||||
@@ -47,7 +55,8 @@ class Login extends \Filament\Auth\Pages\Login
|
||||
|
||||
if (
|
||||
($user instanceof FilamentUser) &&
|
||||
(! $user->canAccessPanel(Filament::getCurrentOrDefaultPanel()))
|
||||
($panel = Filament::getCurrentOrDefaultPanel()) instanceof \Filament\Panel &&
|
||||
(! $user->canAccessPanel($panel))
|
||||
) {
|
||||
Filament::auth()->logout();
|
||||
|
||||
@@ -66,6 +75,9 @@ class Login extends \Filament\Auth\Pages\Login
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<\Illuminate\Contracts\Support\Htmlable|string>
|
||||
*/
|
||||
protected function getFormSchema(): array
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user