Files
pterodactyl-panel/app/Http/Middleware/RedirectIfAuthenticated.php
T

29 lines
584 B
PHP
Raw Normal View History

2015-12-06 13:58:49 -05:00
<?php
namespace Pterodactyl\Http\Middleware;
2017-10-29 12:37:25 -05:00
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
2015-12-06 13:58:49 -05:00
class RedirectIfAuthenticated
{
2017-10-29 12:37:25 -05:00
/**
* RedirectIfAuthenticated constructor.
*/
2022-10-14 10:59:20 -06:00
public function __construct(private AuthManager $authManager)
2017-10-29 12:37:25 -05:00
{
}
2015-12-06 13:58:49 -05:00
/**
* Handle an incoming request.
*/
2022-11-29 10:53:59 -07:00
public function handle(Request $request, \Closure $next, string $guard = null): mixed
2015-12-06 13:58:49 -05:00
{
2017-10-29 12:37:25 -05:00
if ($this->authManager->guard($guard)->check()) {
2017-11-03 18:16:49 -05:00
return redirect()->route('index');
2015-12-06 13:58:49 -05:00
}
return $next($request);
}
}