secure module add
This commit is contained in:
parent
349c2992dc
commit
959d708daf
47
composer.lock
generated
47
composer.lock
generated
@ -337,16 +337,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/collections",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/collections.git",
|
||||
"reference": "cbea9d7a82984bbc1a9376498533cc77513f9a09"
|
||||
"reference": "f205537e0ad131a1a87cb3cf04924e9edda4f2b1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/cbea9d7a82984bbc1a9376498533cc77513f9a09",
|
||||
"reference": "cbea9d7a82984bbc1a9376498533cc77513f9a09",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/f205537e0ad131a1a87cb3cf04924e9edda4f2b1",
|
||||
"reference": "f205537e0ad131a1a87cb3cf04924e9edda4f2b1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -388,11 +388,11 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-09-12T14:50:04+00:00"
|
||||
"time": "2024-09-16T14:32:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/conditionable",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/conditionable.git",
|
||||
@ -438,16 +438,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/container",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/container.git",
|
||||
"reference": "66d20471c8c55ef056044dc1ff16da90d7b4d649"
|
||||
"reference": "d6aca7c315d68cb6807c139facd7ea134b4f5104"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/container/zipball/66d20471c8c55ef056044dc1ff16da90d7b4d649",
|
||||
"reference": "66d20471c8c55ef056044dc1ff16da90d7b4d649",
|
||||
"url": "https://api.github.com/repos/illuminate/container/zipball/d6aca7c315d68cb6807c139facd7ea134b4f5104",
|
||||
"reference": "d6aca7c315d68cb6807c139facd7ea134b4f5104",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -485,20 +485,20 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-09-11T20:15:17+00:00"
|
||||
"time": "2024-09-20T12:51:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/contracts.git",
|
||||
"reference": "5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da"
|
||||
"reference": "56312862af937bd6da8e6dc8bbd88188dfb478f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da",
|
||||
"reference": "5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/56312862af937bd6da8e6dc8bbd88188dfb478f8",
|
||||
"reference": "56312862af937bd6da8e6dc8bbd88188dfb478f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -533,7 +533,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-09-12T15:25:08+00:00"
|
||||
"time": "2024-09-22T15:08:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/database",
|
||||
@ -672,7 +672,7 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/macroable",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/macroable.git",
|
||||
@ -718,16 +718,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"version": "v11.23.5",
|
||||
"version": "v11.24.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/support.git",
|
||||
"reference": "8199097b4e24b05e8a035a6ea2fb5aeba645d71b"
|
||||
"reference": "f1bcdb2205223a70f01ec1750669689154037444"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/8199097b4e24b05e8a035a6ea2fb5aeba645d71b",
|
||||
"reference": "8199097b4e24b05e8a035a6ea2fb5aeba645d71b",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/f1bcdb2205223a70f01ec1750669689154037444",
|
||||
"reference": "f1bcdb2205223a70f01ec1750669689154037444",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -767,6 +767,7 @@
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"functions.php",
|
||||
"helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
@ -789,7 +790,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-09-12T15:25:39+00:00"
|
||||
"time": "2024-09-17T15:56:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "itguild/eloquent-table",
|
||||
@ -2498,5 +2499,5 @@
|
||||
"ext-zip": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class AdminConsoleController extends ConsoleController
|
||||
|
||||
$this->optionService->createFromParams(
|
||||
key: "active_modules",
|
||||
value: "{\"modules\":[\"admin_themes\"]}",
|
||||
value: "{\"modules\":[\"admin_themes\", \"secure\"]}",
|
||||
label: "Активные модули"
|
||||
);
|
||||
$this->out->r("create option active_modules", "green");
|
||||
|
@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\controllers;
|
||||
namespace kernel\modules\secure\controllers;
|
||||
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use kernel\AdminController;
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\models\forms\LoginForm;
|
||||
use kernel\modules\secure\models\forms\LoginForm;
|
||||
use kernel\modules\user\service\UserService;
|
||||
|
||||
class SecureController extends AdminController
|
||||
@ -15,7 +14,8 @@ class SecureController extends AdminController
|
||||
protected function init(): void
|
||||
{
|
||||
parent::init();
|
||||
$this->cgView->viewPath = KERNEL_DIR . "/views/secure/";
|
||||
// $this->cgView->viewPath = KERNEL_DIR . "/views/secure/";
|
||||
$this->cgView->viewPath = KERNEL_MODULES_DIR. "/secure/views/";
|
||||
$this->cgView->layout = "/login.php";
|
||||
$this->userService = new UserService();
|
||||
}
|
||||
@ -53,7 +53,7 @@ class SecureController extends AdminController
|
||||
#[NoReturn] public function actionLogout(): void
|
||||
{
|
||||
unset($_COOKIE['user_id']);
|
||||
setcookie('user_id', "", time() - 3600, '/');
|
||||
setcookie('user_id', "", -1, '/', $_SERVER['SERVER_NAME'], false);
|
||||
$this->redirect("/");
|
||||
}
|
||||
|
8
kernel/modules/secure/manifest.json
Normal file
8
kernel/modules/secure/manifest.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "Secure",
|
||||
"version": "0.1",
|
||||
"author": "ITGuild",
|
||||
"slug": "secure",
|
||||
"description": "Secure module",
|
||||
"routs": "routs/secure.php"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\models\forms;
|
||||
namespace kernel\modules\secure\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
22
kernel/modules/secure/routs/secure.php
Normal file
22
kernel/modules/secure/routs/secure.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use kernel\App;
|
||||
use Phroute\Phroute\RouteCollector;
|
||||
|
||||
App::$collector->filter("auth", function (){
|
||||
if(!isset($_COOKIE['user_id']))
|
||||
{
|
||||
header('Location: /admin/login');
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
|
||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||
});
|
||||
App::$collector->get('/login', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogin']);
|
||||
App::$collector->get('/logout', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogout']);
|
||||
App::$collector->post('/auth', [\kernel\modules\secure\controllers\SecureController::class, 'actionAuth']);
|
||||
});
|
@ -1,26 +1,24 @@
|
||||
<?php
|
||||
|
||||
use app\controllers\MainController;
|
||||
use kernel\App;
|
||||
use kernel\modules\admin_themes\controllers\AdminThemeController;
|
||||
use Phroute\Phroute\RouteCollector;
|
||||
|
||||
App::$collector->filter("auth", function (){
|
||||
if(!isset($_COOKIE['user_id']))
|
||||
{
|
||||
header('Location: /admin/login');
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//App::$collector->filter("auth", function (){
|
||||
// if(!isset($_COOKIE['user_id']))
|
||||
// {
|
||||
// header('Location: /admin/login');
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//});
|
||||
|
||||
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
|
||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||
});
|
||||
App::$collector->get('/login', [\kernel\controllers\SecureController::class, 'actionLogin']);
|
||||
App::$collector->get('/logout', [\kernel\controllers\SecureController::class, 'actionLogout']);
|
||||
App::$collector->post('/auth', [\kernel\controllers\SecureController::class, 'actionAuth']);
|
||||
// App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||
// App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||
// });
|
||||
// App::$collector->get('/login', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogin']);
|
||||
// App::$collector->get('/logout', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogout']);
|
||||
// App::$collector->post('/auth', [\kernel\modules\secure\controllers\SecureController::class, 'actionAuth']);
|
||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||
App::$collector->group(["prefix" => "module"], function (RouteCollector $router){
|
||||
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||
|
Loading…
Reference in New Issue
Block a user