route controller auth checking
there was no auth checking for dashboard and theme routing, so that's been added
This commit is contained in:
parent
b6425e2c07
commit
bd25c0b104
1 changed files with 21 additions and 8 deletions
|
@ -6,25 +6,29 @@ use App\Http\Controllers\Dash\IndexController;
|
||||||
use App\Http\Controllers\Dash\AuthController;
|
use App\Http\Controllers\Dash\AuthController;
|
||||||
use App\Http\Controllers\Front\StartController;
|
use App\Http\Controllers\Front\StartController;
|
||||||
use App\Http\Controllers\Theming\ThemeController;
|
use App\Http\Controllers\Theming\ThemeController;
|
||||||
|
use App\Services\AuthService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class RouteController extends Controller
|
class RouteController extends Controller
|
||||||
{
|
{
|
||||||
protected $dash;
|
protected $dash;
|
||||||
protected $auth;
|
protected $gate;
|
||||||
protected $theme;
|
protected $theme;
|
||||||
protected $front;
|
protected $front;
|
||||||
|
protected $auth;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IndexController $indexController,
|
IndexController $indexController,
|
||||||
AuthController $authController,
|
AuthController $authController,
|
||||||
ThemeController $themeController,
|
ThemeController $themeController,
|
||||||
StartController $startContoller,
|
StartController $startContoller,
|
||||||
|
AuthService $authService,
|
||||||
) {
|
) {
|
||||||
$this->dash = $indexController;
|
$this->dash = $indexController;
|
||||||
$this->auth = $authController;
|
$this->gate = $authController;
|
||||||
$this->theme = $themeController;
|
$this->theme = $themeController;
|
||||||
$this->front = $startContoller;
|
$this->front = $startContoller;
|
||||||
|
$this->auth = $authService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($first = null, $second = null, $third = null, $fourth = null)
|
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)) {
|
if (isset($first) && !is_numeric($first)) {
|
||||||
switch ($first) {
|
switch ($first) {
|
||||||
case 'dashboard':
|
case 'dashboard':
|
||||||
if (isset($second)) {
|
if ($this->auth::status()) {
|
||||||
return $this->dash->init($second, $third, $fourth);
|
if (isset($second)) {
|
||||||
|
return $this->dash->init($second, $third, $fourth);
|
||||||
|
} else {
|
||||||
|
return $this->dash->start();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->dash->login();
|
return $this->dash->login();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'theme':
|
case 'theme':
|
||||||
if (isset($second)) {
|
if ($this->auth::status()) {
|
||||||
return $this->theme->getView($third);
|
if (isset($second)) {
|
||||||
|
return $this->theme->getView($third);
|
||||||
|
} else {
|
||||||
|
return $this->theme->start();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->theme->start();
|
return $this->dash->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'tags':
|
case 'tags':
|
||||||
case 'archives':
|
case 'archives':
|
||||||
|
@ -59,7 +72,7 @@ class RouteController extends Controller
|
||||||
{
|
{
|
||||||
switch ($request->path()) {
|
switch ($request->path()) {
|
||||||
case 'login':
|
case 'login':
|
||||||
return $this->auth->enter($request);
|
return $this->gate->enter($request);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue