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",
|
"name": "illuminate/collections",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/collections.git",
|
"url": "https://github.com/illuminate/collections.git",
|
||||||
"reference": "cbea9d7a82984bbc1a9376498533cc77513f9a09"
|
"reference": "f205537e0ad131a1a87cb3cf04924e9edda4f2b1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/cbea9d7a82984bbc1a9376498533cc77513f9a09",
|
"url": "https://api.github.com/repos/illuminate/collections/zipball/f205537e0ad131a1a87cb3cf04924e9edda4f2b1",
|
||||||
"reference": "cbea9d7a82984bbc1a9376498533cc77513f9a09",
|
"reference": "f205537e0ad131a1a87cb3cf04924e9edda4f2b1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -388,11 +388,11 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"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",
|
"name": "illuminate/conditionable",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/conditionable.git",
|
"url": "https://github.com/illuminate/conditionable.git",
|
||||||
@ -438,16 +438,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/container",
|
"name": "illuminate/container",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/container.git",
|
"url": "https://github.com/illuminate/container.git",
|
||||||
"reference": "66d20471c8c55ef056044dc1ff16da90d7b4d649"
|
"reference": "d6aca7c315d68cb6807c139facd7ea134b4f5104"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/container/zipball/66d20471c8c55ef056044dc1ff16da90d7b4d649",
|
"url": "https://api.github.com/repos/illuminate/container/zipball/d6aca7c315d68cb6807c139facd7ea134b4f5104",
|
||||||
"reference": "66d20471c8c55ef056044dc1ff16da90d7b4d649",
|
"reference": "d6aca7c315d68cb6807c139facd7ea134b4f5104",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -485,20 +485,20 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"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",
|
"name": "illuminate/contracts",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/contracts.git",
|
"url": "https://github.com/illuminate/contracts.git",
|
||||||
"reference": "5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da"
|
"reference": "56312862af937bd6da8e6dc8bbd88188dfb478f8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da",
|
"url": "https://api.github.com/repos/illuminate/contracts/zipball/56312862af937bd6da8e6dc8bbd88188dfb478f8",
|
||||||
"reference": "5a4c6dcf633c1f69e1b70bbea1ef1b7d2186d3da",
|
"reference": "56312862af937bd6da8e6dc8bbd88188dfb478f8",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -533,7 +533,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"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",
|
"name": "illuminate/database",
|
||||||
@ -672,7 +672,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/macroable",
|
"name": "illuminate/macroable",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/macroable.git",
|
"url": "https://github.com/illuminate/macroable.git",
|
||||||
@ -718,16 +718,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/support",
|
"name": "illuminate/support",
|
||||||
"version": "v11.23.5",
|
"version": "v11.24.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/support.git",
|
"url": "https://github.com/illuminate/support.git",
|
||||||
"reference": "8199097b4e24b05e8a035a6ea2fb5aeba645d71b"
|
"reference": "f1bcdb2205223a70f01ec1750669689154037444"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/support/zipball/8199097b4e24b05e8a035a6ea2fb5aeba645d71b",
|
"url": "https://api.github.com/repos/illuminate/support/zipball/f1bcdb2205223a70f01ec1750669689154037444",
|
||||||
"reference": "8199097b4e24b05e8a035a6ea2fb5aeba645d71b",
|
"reference": "f1bcdb2205223a70f01ec1750669689154037444",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -767,6 +767,7 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
|
"functions.php",
|
||||||
"helpers.php"
|
"helpers.php"
|
||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -789,7 +790,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"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",
|
"name": "itguild/eloquent-table",
|
||||||
@ -2498,5 +2499,5 @@
|
|||||||
"ext-zip": "*"
|
"ext-zip": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"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(
|
$this->optionService->createFromParams(
|
||||||
key: "active_modules",
|
key: "active_modules",
|
||||||
value: "{\"modules\":[\"admin_themes\"]}",
|
value: "{\"modules\":[\"admin_themes\", \"secure\"]}",
|
||||||
label: "Активные модули"
|
label: "Активные модули"
|
||||||
);
|
);
|
||||||
$this->out->r("create option active_modules", "green");
|
$this->out->r("create option active_modules", "green");
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace kernel\controllers;
|
namespace kernel\modules\secure\controllers;
|
||||||
|
|
||||||
use JetBrains\PhpStorm\NoReturn;
|
use JetBrains\PhpStorm\NoReturn;
|
||||||
use kernel\AdminController;
|
use kernel\AdminController;
|
||||||
use kernel\helpers\Debug;
|
use kernel\modules\secure\models\forms\LoginForm;
|
||||||
use kernel\models\forms\LoginForm;
|
|
||||||
use kernel\modules\user\service\UserService;
|
use kernel\modules\user\service\UserService;
|
||||||
|
|
||||||
class SecureController extends AdminController
|
class SecureController extends AdminController
|
||||||
@ -15,7 +14,8 @@ class SecureController extends AdminController
|
|||||||
protected function init(): void
|
protected function init(): void
|
||||||
{
|
{
|
||||||
parent::init();
|
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->cgView->layout = "/login.php";
|
||||||
$this->userService = new UserService();
|
$this->userService = new UserService();
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class SecureController extends AdminController
|
|||||||
#[NoReturn] public function actionLogout(): void
|
#[NoReturn] public function actionLogout(): void
|
||||||
{
|
{
|
||||||
unset($_COOKIE['user_id']);
|
unset($_COOKIE['user_id']);
|
||||||
setcookie('user_id', "", time() - 3600, '/');
|
setcookie('user_id', "", -1, '/', $_SERVER['SERVER_NAME'], false);
|
||||||
$this->redirect("/");
|
$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
|
<?php
|
||||||
|
|
||||||
namespace kernel\models\forms;
|
namespace kernel\modules\secure\models\forms;
|
||||||
|
|
||||||
use kernel\FormModel;
|
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
|
<?php
|
||||||
|
|
||||||
use app\controllers\MainController;
|
|
||||||
use kernel\App;
|
use kernel\App;
|
||||||
use kernel\modules\admin_themes\controllers\AdminThemeController;
|
|
||||||
use Phroute\Phroute\RouteCollector;
|
use Phroute\Phroute\RouteCollector;
|
||||||
|
|
||||||
App::$collector->filter("auth", function (){
|
//App::$collector->filter("auth", function (){
|
||||||
if(!isset($_COOKIE['user_id']))
|
// if(!isset($_COOKIE['user_id']))
|
||||||
{
|
// {
|
||||||
header('Location: /admin/login');
|
// header('Location: /admin/login');
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
});
|
//});
|
||||||
|
|
||||||
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
|
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
|
||||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
// App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||||
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
// App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||||
});
|
// });
|
||||||
App::$collector->get('/login', [\kernel\controllers\SecureController::class, 'actionLogin']);
|
// App::$collector->get('/login', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogin']);
|
||||||
App::$collector->get('/logout', [\kernel\controllers\SecureController::class, 'actionLogout']);
|
// App::$collector->get('/logout', [\kernel\modules\secure\controllers\SecureController::class, 'actionLogout']);
|
||||||
App::$collector->post('/auth', [\kernel\controllers\SecureController::class, 'actionAuth']);
|
// App::$collector->post('/auth', [\kernel\modules\secure\controllers\SecureController::class, 'actionAuth']);
|
||||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
||||||
App::$collector->group(["prefix" => "module"], function (RouteCollector $router){
|
App::$collector->group(["prefix" => "module"], function (RouteCollector $router){
|
||||||
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
||||||
|
Loading…
Reference in New Issue
Block a user