route controller auth checking

there was no auth checking for dashboard and theme routing, so that's
been added
This commit is contained in:
ro 2024-05-08 12:27:56 -06:00
parent b6425e2c07
commit bd25c0b104
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50

View file

@ -6,25 +6,29 @@ use App\Http\Controllers\Dash\IndexController;
use App\Http\Controllers\Dash\AuthController;
use App\Http\Controllers\Front\StartController;
use App\Http\Controllers\Theming\ThemeController;
use App\Services\AuthService;
use Illuminate\Http\Request;
class RouteController extends Controller
{
protected $dash;
protected $auth;
protected $gate;
protected $theme;
protected $front;
protected $auth;
public function __construct(
IndexController $indexController,
AuthController $authController,
ThemeController $themeController,
StartController $startContoller,
AuthService $authService,
) {
$this->dash = $indexController;
$this->auth = $authController;
$this->gate = $authController;
$this->theme = $themeController;
$this->front = $startContoller;
$this->auth = $authService;
}
public function get($first = null, $second = null, $third = null, $fourth = null)
@ -32,18 +36,27 @@ class RouteController extends Controller
if (isset($first) && !is_numeric($first)) {
switch ($first) {
case 'dashboard':
if (isset($second)) {
return $this->dash->init($second, $third, $fourth);
if ($this->auth::status()) {
if (isset($second)) {
return $this->dash->init($second, $third, $fourth);
} else {
return $this->dash->start();
}
} else {
return $this->dash->login();
}
break;
case 'theme':
if (isset($second)) {
return $this->theme->getView($third);
if ($this->auth::status()) {
if (isset($second)) {
return $this->theme->getView($third);
} else {
return $this->theme->start();
}
} else {
return $this->theme->start();
return $this->dash->login();
}
break;
case 'tags':
case 'archives':
@ -59,7 +72,7 @@ class RouteController extends Controller
{
switch ($request->path()) {
case 'login':
return $this->auth->enter($request);
return $this->gate->enter($request);
break;
}
}