Render Hook in middleware problem

Hello,

I'm trying to show a custom message before login form with middleware if user is not active.
But no success...

I create a custom Middleware
CheckIsActive
to replace Authenticate in authMiddleware array of my
AdminPanelProvider


->authMiddleware([  
    CheckIsActive::class,
    //Authenticate::class,])


use Filament\Http\Middleware\Authenticate;
class CheckIsActive extends Authenticate  
{  
    protected function authenticate($request, array $guards): void  
  {  
        $auth = Filament::auth();  
        $user = $auth->user();  
        $panel = Filament::getCurrentPanel();  
  
        if (! ($auth->check()  
            && $user instanceof FilamentUser  
  && $user->canAccessPanel($panel)  
            && $user->is_active)) {  
            Session::flush();  
            FilamentView::registerRenderHook(  
                'panels::auth.login.form.before',  
                fn (): View => view('filament.views.general.hook-before-login')  
            );
            $this->unauthenticated($request, $guards);
        }  
    }  
  
    protected function redirectTo($request): ?string  
  {
        return Filament::getLoginUrl();  
    }  
}

If user is not active, redirect works but my view for auth.login.form.before hook is not showed
What I'm missing ?
Was this page helpful?