feat: release SysMVC 2.0 with enhanced CSRF protection and UI improvements
Major version upgrade from 1.0.0 to 2.0.0 including copyright year updates, website URL migration to syspanel.com.br, and comprehensive CSRF token handling improvements. The Twig csrf() helper now returns a complete hidden input field instead of a raw token value, and token generation is now automatic when empty. Session initialization has been centralized in BaseController, and child controllers now properly call parent constructors. CRUD views have been modernized with flexbox layouts and consistent CSRF rendering. Documentation has been expanded with features, requirements, and project structure sections, and donation sections have been added across all pages.
This commit is contained in:
@@ -17,6 +17,7 @@ class CrudExampleController extends BaseController
|
||||
|
||||
public function __construct(BladeOne $blade, Logger $logger)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->blade = $blade;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
@@ -56,10 +57,9 @@ class CrudExampleController extends BaseController
|
||||
return 'Record not found';
|
||||
}
|
||||
|
||||
$csrfToken = generateCsrfToken();
|
||||
$crudexample = Sanitizer::sanitizeOutput($crudexample->toArray());
|
||||
|
||||
return $this->blade->run('crudexample.edit', ['crudexample' => $crudexample, 'csrfToken' => $csrfToken]);
|
||||
return $this->blade->run('crudexample.edit', ['crudexample' => $crudexample]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error when displaying the edit page: ' . $e->getMessage());
|
||||
return 'Error when displaying the edit page: ' . $e->getMessage();
|
||||
|
||||
@@ -18,6 +18,6 @@ class IndexController extends BaseController
|
||||
public function index()
|
||||
{
|
||||
// Pass data to the view and render
|
||||
return $this->blade->run('home', ['title' => 'Welcome to SysMVC2025!']);
|
||||
return $this->blade->run('home', ['title' => 'Welcome to SysMVC 2.0!']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class TwigExampleController extends BaseController
|
||||
|
||||
public function __construct(Environment $twig, Logger $logger, BladeOne $blade)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->twig = $twig;
|
||||
$this->logger = $logger;
|
||||
$this->blade = $blade;
|
||||
@@ -53,7 +54,7 @@ class TwigExampleController extends BaseController
|
||||
{
|
||||
try {
|
||||
$this->logger->info('Displaying the creation page of the TwigExampleController.');
|
||||
return $this->twig->render('twigexample/create.twig.php', ['csrf_token' => htmlspecialchars(getCsrfToken(), ENT_QUOTES, 'UTF-8')]);
|
||||
return $this->twig->render('twigexample/create.twig.php');
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error displaying the creation page: ' . $e->getMessage());
|
||||
return 'Error displaying the creation page: ' . $e->getMessage();
|
||||
@@ -73,7 +74,7 @@ class TwigExampleController extends BaseController
|
||||
$twigexample = Sanitizer::sanitizeOutput($twigexample->toArray());
|
||||
|
||||
$this->logger->info("Displaying the edit page for the record with ID: $id.");
|
||||
return $this->twig->render('twigexample/edit.twig.php', ['twigexample' => $twigexample, 'csrf_token' => htmlspecialchars(getCsrfToken(), ENT_QUOTES, 'UTF-8')]);
|
||||
return $this->twig->render('twigexample/edit.twig.php', ['twigexample' => $twigexample]);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error displaying the edit page: ' . $e->getMessage());
|
||||
return 'Error displaying the edit page: ' . $e->getMessage();
|
||||
|
||||
@@ -6,6 +6,9 @@ class BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
// Adding security headers
|
||||
header("Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted.cdn.com; style-src 'self' https://trusted.cdn.com; img-src 'self' data:;");
|
||||
header("X-Frame-Options: DENY");
|
||||
|
||||
Reference in New Issue
Block a user