Support the ongoing development of Laravel.io →
Authentication Security Requests
Last updated 1 year ago.
0

I guess you could add a condition to your middleware to check for that.

public function handle($request, Closure $next)
{
       if ($this->auth->check() or $request->is("auth/login"))
       {
                return $next($request);
       } else
       {
                return redirect()->guest('auth/login');
       }
}
Last updated 9 years ago.
0

I had the exact same question and I came with the same 2 answers. But I believe the "plan B" is better. Don't touch the AuthController and instead group all the routes that need the middleware together, and just put your couple of auth routes that don't take the middleware on the top. Clean and clear.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.