mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Actualizando entre versiones de CI4 (upgrade
This commit is contained in:
5
.idea/php.xml
generated
5
.idea/php.xml
generated
@ -63,6 +63,11 @@
|
|||||||
<component name="PhpStanOptionsConfiguration">
|
<component name="PhpStanOptionsConfiguration">
|
||||||
<option name="transferred" value="true" />
|
<option name="transferred" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PhpUnit">
|
||||||
|
<phpunit_settings>
|
||||||
|
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/ci4/vendor/autoload.php" />
|
||||||
|
</phpunit_settings>
|
||||||
|
</component>
|
||||||
<component name="PsalmOptionsConfiguration">
|
<component name="PsalmOptionsConfiguration">
|
||||||
<option name="transferred" value="true" />
|
<option name="transferred" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -13,19 +13,19 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Config;
|
namespace Config;
|
||||||
|
|
||||||
|
use App\Models\UserModel;
|
||||||
|
use CodeIgniter\Shield\Authentication\Passwords\ValidationRules;
|
||||||
use CodeIgniter\Shield\Config\Auth as ShieldAuth;
|
use CodeIgniter\Shield\Config\Auth as ShieldAuth;
|
||||||
use CodeIgniter\Shield\Authentication\Actions\ActionInterface;
|
use CodeIgniter\Shield\Authentication\Actions\ActionInterface;
|
||||||
use CodeIgniter\Shield\Authentication\AuthenticatorInterface;
|
use CodeIgniter\Shield\Authentication\AuthenticatorInterface;
|
||||||
use CodeIgniter\Shield\Authentication\Authenticators\AccessTokens;
|
use CodeIgniter\Shield\Authentication\Authenticators\AccessTokens;
|
||||||
use CodeIgniter\Shield\Authentication\Authenticators\HmacSha256;
|
use CodeIgniter\Shield\Authentication\Authenticators\HmacSha256;
|
||||||
use CodeIgniter\Shield\Authentication\Authenticators\JWT;
|
|
||||||
use CodeIgniter\Shield\Authentication\Authenticators\Session;
|
use CodeIgniter\Shield\Authentication\Authenticators\Session;
|
||||||
use CodeIgniter\Shield\Authentication\Passwords\CompositionValidator;
|
use CodeIgniter\Shield\Authentication\Passwords\CompositionValidator;
|
||||||
use CodeIgniter\Shield\Authentication\Passwords\DictionaryValidator;
|
use CodeIgniter\Shield\Authentication\Passwords\DictionaryValidator;
|
||||||
use CodeIgniter\Shield\Authentication\Passwords\NothingPersonalValidator;
|
use CodeIgniter\Shield\Authentication\Passwords\NothingPersonalValidator;
|
||||||
use CodeIgniter\Shield\Authentication\Passwords\PwnedValidator;
|
use CodeIgniter\Shield\Authentication\Passwords\PwnedValidator;
|
||||||
use CodeIgniter\Shield\Authentication\Passwords\ValidatorInterface;
|
use CodeIgniter\Shield\Authentication\Passwords\ValidatorInterface;
|
||||||
use CodeIgniter\Shield\Models\UserModel;
|
|
||||||
|
|
||||||
class Auth extends ShieldAuth
|
class Auth extends ShieldAuth
|
||||||
{
|
{
|
||||||
@ -269,7 +269,7 @@ class Auth extends ShieldAuth
|
|||||||
public array $passwordValidators = [
|
public array $passwordValidators = [
|
||||||
CompositionValidator::class,
|
CompositionValidator::class,
|
||||||
NothingPersonalValidator::class,
|
NothingPersonalValidator::class,
|
||||||
DictionaryValidator::class,
|
DictionaryValidator::class
|
||||||
// PwnedValidator::class,
|
// PwnedValidator::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,12 @@ use CodeIgniter\Config\AutoloadConfig;
|
|||||||
* can find the files as needed.
|
* can find the files as needed.
|
||||||
*
|
*
|
||||||
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
||||||
* the values in this file will overwrite the framework's values.
|
* the values in this file will overwrite the framework's values.
|
||||||
|
*
|
||||||
|
* NOTE: This class is required prior to Autoloader instantiation,
|
||||||
|
* and does not extend BaseConfig.
|
||||||
|
*
|
||||||
|
* @immutable
|
||||||
*/
|
*/
|
||||||
class Autoload extends AutoloadConfig
|
class Autoload extends AutoloadConfig
|
||||||
{
|
{
|
||||||
@ -31,14 +36,12 @@ class Autoload extends AutoloadConfig
|
|||||||
* else you will need to modify all of those classes for this to work.
|
* else you will need to modify all of those classes for this to work.
|
||||||
*
|
*
|
||||||
* Prototype:
|
* Prototype:
|
||||||
*```
|
|
||||||
* $psr4 = [
|
* $psr4 = [
|
||||||
* 'CodeIgniter' => SYSTEMPATH,
|
* 'CodeIgniter' => SYSTEMPATH,
|
||||||
* 'App' => APPPATH
|
* 'App' => APPPATH
|
||||||
* ];
|
* ];
|
||||||
*```
|
|
||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, list<string>|string>
|
||||||
*/
|
*/
|
||||||
public $psr4 = [
|
public $psr4 = [
|
||||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||||
@ -57,11 +60,9 @@ class Autoload extends AutoloadConfig
|
|||||||
* were being autoloaded through a namespace.
|
* were being autoloaded through a namespace.
|
||||||
*
|
*
|
||||||
* Prototype:
|
* Prototype:
|
||||||
*```
|
|
||||||
* $classmap = [
|
* $classmap = [
|
||||||
* 'MyClass' => '/path/to/class/file.php'
|
* 'MyClass' => '/path/to/class/file.php'
|
||||||
* ];
|
* ];
|
||||||
*```
|
|
||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
@ -76,13 +77,11 @@ class Autoload extends AutoloadConfig
|
|||||||
* or for loading functions.
|
* or for loading functions.
|
||||||
*
|
*
|
||||||
* Prototype:
|
* Prototype:
|
||||||
* ```
|
* $files = [
|
||||||
* $files = [
|
* '/path/to/my/file.php',
|
||||||
* '/path/to/my/file.php',
|
* ];
|
||||||
* ];
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @var array<int, string>
|
* @var list<string>
|
||||||
*/
|
*/
|
||||||
public $files = [];
|
public $files = [];
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,10 @@
|
|||||||
| In development, we want to show as many errors as possible to help
|
| In development, we want to show as many errors as possible to help
|
||||||
| make sure they don't make it to production. And save us hours of
|
| make sure they don't make it to production. And save us hours of
|
||||||
| painful debugging.
|
| painful debugging.
|
||||||
|
|
|
||||||
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
|
||||||
*/
|
*/
|
||||||
error_reporting(-1);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -6,6 +6,8 @@
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Don't show ANY in production environments. Instead, let the system catch
|
| Don't show ANY in production environments. Instead, let the system catch
|
||||||
| it and display a generic error message.
|
| it and display a generic error message.
|
||||||
|
|
|
||||||
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
|
||||||
*/
|
*/
|
||||||
ini_set('display_errors', '0');
|
ini_set('display_errors', '0');
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The environment testing is reserved for PHPUnit testing. It has special
|
||||||
|
* conditions built into the framework at various places to assist with that.
|
||||||
|
* You can’t use it for your development.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| ERROR DISPLAY
|
| ERROR DISPLAY
|
||||||
@ -8,7 +14,7 @@
|
|||||||
| make sure they don't make it to production. And save us hours of
|
| make sure they don't make it to production. And save us hours of
|
||||||
| painful debugging.
|
| painful debugging.
|
||||||
*/
|
*/
|
||||||
error_reporting(-1);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Config;
|
namespace Config;
|
||||||
|
|
||||||
|
|
||||||
|
use CodeIgniter\Shield\Authentication\Passwords\ValidationRules;
|
||||||
use CodeIgniter\Validation\CreditCardRules;
|
use CodeIgniter\Validation\CreditCardRules;
|
||||||
use CodeIgniter\Validation\FileRules;
|
use CodeIgniter\Validation\FileRules;
|
||||||
use CodeIgniter\Validation\FormatRules;
|
use CodeIgniter\Validation\FormatRules;
|
||||||
@ -19,12 +21,12 @@ class Validation
|
|||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
public $ruleSets = [
|
public array $ruleSets = [
|
||||||
Rules::class,
|
Rules::class,
|
||||||
FormatRules::class,
|
FormatRules::class,
|
||||||
FileRules::class,
|
FileRules::class,
|
||||||
CreditCardRules::class,
|
CreditCardRules::class,
|
||||||
\App\Validation\ApiAuthRules::class,
|
ValidationRules::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +35,7 @@ class Validation
|
|||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
public $templates = [
|
public array $templates = [
|
||||||
'list' => 'CodeIgniter\Validation\Views\list',
|
'list' => 'CodeIgniter\Validation\Views\list',
|
||||||
'single' => 'CodeIgniter\Validation\Views\single',
|
'single' => 'CodeIgniter\Validation\Views\single',
|
||||||
'bootstrap_style' => 'themes/_commonPartialsBs/_form_validation_errors',
|
'bootstrap_style' => 'themes/_commonPartialsBs/_form_validation_errors',
|
||||||
@ -43,4 +45,38 @@ class Validation
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Rules
|
// Rules
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Rules For Login
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
/*public $login = [
|
||||||
|
// 'username' => [
|
||||||
|
// 'label' => 'Auth.username',
|
||||||
|
// 'rules' => [
|
||||||
|
// 'required',
|
||||||
|
// 'max_length[30]',
|
||||||
|
// 'min_length[3]',
|
||||||
|
// 'regex_match[/\A[a-zA-Z0-9\.]+\z/]',
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
'email' => [
|
||||||
|
'label' => 'Auth.email',
|
||||||
|
'rules' => [
|
||||||
|
'required',
|
||||||
|
'max_length[254]',
|
||||||
|
'valid_email'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'password' => [
|
||||||
|
'label' => 'Auth.password',
|
||||||
|
'rules' => [
|
||||||
|
'required',
|
||||||
|
'max_byte[72]',
|
||||||
|
],
|
||||||
|
'errors' => [
|
||||||
|
'max_byte' => 'Auth.errorPasswordTooLongBytes',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Validation;
|
|
||||||
|
|
||||||
use App\Libraries\PasswordHash;
|
|
||||||
use App\Models\SettingsModel;
|
|
||||||
use App\Models\Usuarios\UserModel;
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class ApiAuthRules
|
|
||||||
{
|
|
||||||
public function validateAuthPassword(string $str, string $fields, array $data): bool
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$user_model = new UserModel();
|
|
||||||
$obj = $user_model->where('email',$data['email'])->first();
|
|
||||||
$phpass = new PasswordHash(8, true);
|
|
||||||
return $phpass->CheckPassword($data['password']??'', $obj['password']);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function validateAuthPermission(string $str, string $fields, array $data): bool
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$user_model = new UserModel();
|
|
||||||
$settings_model = new SettingsModel();
|
|
||||||
$settings = $settings_model->first()??[];
|
|
||||||
$obj = $user_model->where('email',$data['email'])->first();
|
|
||||||
return $settings['group_api'] == $obj['group'];
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -269,7 +269,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -502,7 +502,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -267,7 +267,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -204,7 +204,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -272,7 +272,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -174,7 +174,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<span class="ml-2"><?= lang("App.menu_activity") ?></span>
|
<span class="ml-2"><?= lang("App.menu_activity") ?></span>
|
||||||
</a>
|
</a>
|
||||||
--->
|
--->
|
||||||
<a href="<?= site_url('login/logout'); ?>" class="dropdown-item">
|
<a href="<?= site_url('logout'); ?>" class="dropdown-item">
|
||||||
<i class="fas fa-sign-out-alt"></i>
|
<i class="fas fa-sign-out-alt"></i>
|
||||||
<span class="ml-2"><?= lang("App.menu_logout") ?></span>
|
<span class="ml-2"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -273,7 +273,7 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?= site_url("login/logout") ?>">
|
<a class="dropdown-item" href="<?= site_url("logout") ?>">
|
||||||
<i class="ti ti-logout me-2 ti-sm"></i>
|
<i class="ti ti-logout me-2 ti-sm"></i>
|
||||||
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
<span class="align-middle"><?= lang("App.menu_logout") ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user