diff --git a/.env b/.env old mode 100644 new mode 100755 diff --git a/.env.test b/.env.test old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 084f476..a2d7bbf --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,6 @@ /uploads/* -!uploads/.gitkeep \ No newline at end of file +!uploads/.gitkeep + +/public/kumora/ \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100755 index 0000000..5f28e7a --- /dev/null +++ b/.htaccess @@ -0,0 +1,11 @@ + + RewriteEngine On + + # Rediriger les assets + RewriteCond %{REQUEST_URI} ^/kumora/assets/ + RewriteRule ^kumora/assets/(.*)$ assets/$1 [L] + + # Rediriger toutes les autres requĂȘtes vers le dossier public + RewriteCond %{REQUEST_URI} !^/kumora/public/ + RewriteRule ^(.*)$ public/$1 [L] + diff --git a/.symfony.local.yaml b/.symfony.local.yaml old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/assets/app.js b/assets/app.js old mode 100644 new mode 100755 diff --git a/assets/bootstrap.js b/assets/bootstrap.js old mode 100644 new mode 100755 diff --git a/assets/controllers.json b/assets/controllers.json old mode 100644 new mode 100755 diff --git a/assets/controllers/.gitkeep b/assets/controllers/.gitkeep old mode 100644 new mode 100755 diff --git a/assets/controllers/csrf_protection_controller.js b/assets/controllers/csrf_protection_controller.js old mode 100644 new mode 100755 diff --git a/assets/icons/symfony.svg b/assets/icons/symfony.svg old mode 100644 new mode 100755 diff --git a/assets/images/favicon.ico b/assets/images/favicon.ico old mode 100644 new mode 100755 diff --git a/assets/images/logo.png b/assets/images/logo.png old mode 100644 new mode 100755 diff --git a/assets/styles/app.css b/assets/styles/app.css old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 index e2774e8..cce3927 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "oneup/flysystem-bundle": "^4.12.3", "phpdocumentor/reflection-docblock": "^5.6.1", "phpstan/phpdoc-parser": "^2.0", + "symfony/apache-pack": "^1.0", "symfony/asset": "7.2.*", "symfony/asset-mapper": "7.2.*", "symfony/console": "7.2.*", diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 index 5dc1056..510cd22 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e09298f3e588af757a6dc171b49156ce", + "content-hash": "3032276cf7af61e3028a0f94b2488b8d", "packages": [ { "name": "composer/semver", @@ -2403,6 +2403,32 @@ }, "time": "2021-10-29T13:26:27+00:00" }, + { + "name": "symfony/apache-pack", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/apache-pack.git", + "reference": "3aa5818d73ad2551281fc58a75afd9ca82622e6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/apache-pack/zipball/3aa5818d73ad2551281fc58a75afd9ca82622e6c", + "reference": "3aa5818d73ad2551281fc58a75afd9ca82622e6c", + "shasum": "" + }, + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A pack for Apache support in Symfony", + "support": { + "issues": "https://github.com/symfony/apache-pack/issues", + "source": "https://github.com/symfony/apache-pack/tree/master" + }, + "time": "2017-12-12T01:46:35+00:00" + }, { "name": "symfony/asset", "version": "v7.2.0", diff --git a/config/bundles.php b/config/bundles.php old mode 100644 new mode 100755 diff --git a/config/packages/asset_mapper.yaml b/config/packages/asset_mapper.yaml old mode 100644 new mode 100755 index f7653e9..41ba603 --- a/config/packages/asset_mapper.yaml +++ b/config/packages/asset_mapper.yaml @@ -4,6 +4,7 @@ framework: paths: - assets/ missing_import_mode: strict + public_prefix: /kumora/assets when@prod: framework: diff --git a/config/packages/cache.yaml b/config/packages/cache.yaml old mode 100644 new mode 100755 diff --git a/config/packages/csrf.yaml b/config/packages/csrf.yaml old mode 100644 new mode 100755 diff --git a/config/packages/debug.yaml b/config/packages/debug.yaml old mode 100644 new mode 100755 diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml old mode 100644 new mode 100755 diff --git a/config/packages/doctrine_migrations.yaml b/config/packages/doctrine_migrations.yaml old mode 100644 new mode 100755 diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml old mode 100644 new mode 100755 diff --git a/config/packages/mailer.yaml b/config/packages/mailer.yaml old mode 100644 new mode 100755 diff --git a/config/packages/messenger.yaml b/config/packages/messenger.yaml old mode 100644 new mode 100755 diff --git a/config/packages/monolog.yaml b/config/packages/monolog.yaml old mode 100644 new mode 100755 diff --git a/config/packages/notifier.yaml b/config/packages/notifier.yaml old mode 100644 new mode 100755 diff --git a/config/packages/oneup_flysystem.yaml b/config/packages/oneup_flysystem.yaml old mode 100644 new mode 100755 diff --git a/config/packages/routing.yaml b/config/packages/routing.yaml old mode 100644 new mode 100755 diff --git a/config/packages/security.yaml b/config/packages/security.yaml old mode 100644 new mode 100755 index 405c27d..1818304 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,7 +1,7 @@ security: # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: - Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: "auto" # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider providers: # used to reload user from session & other features (e.g. switch_user) @@ -20,10 +20,12 @@ security: login_path: app_login check_path: app_login enable_csrf: true + default_target_path: app_home + always_use_default_target_path: true logout: path: app_logout # where to redirect after logout - # target: app_any_route + target: app_home # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall @@ -45,7 +47,7 @@ when@test: # are not important, waste resources and increase test times. The following # reduces the work factor to the lowest possible values. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: - algorithm: auto - cost: 4 # Lowest possible value for bcrypt - time_cost: 3 # Lowest possible value for argon - memory_cost: 10 # Lowest possible value for argon + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/packages/translation.yaml b/config/packages/translation.yaml old mode 100644 new mode 100755 diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml old mode 100644 new mode 100755 diff --git a/config/packages/twig_component.yaml b/config/packages/twig_component.yaml old mode 100644 new mode 100755 diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml old mode 100644 new mode 100755 diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml old mode 100644 new mode 100755 index b946111..1d426c9 --- a/config/packages/web_profiler.yaml +++ b/config/packages/web_profiler.yaml @@ -2,7 +2,8 @@ when@dev: web_profiler: toolbar: true intercept_redirects: false - + excluded_ajax_paths: '^/((index|app(_[\w]+)?)\.php/)?(?!/kumora)(_(profiler|wdt)|css|images|js)/' + framework: profiler: only_exceptions: false diff --git a/config/preload.php b/config/preload.php old mode 100644 new mode 100755 diff --git a/config/routes.yaml b/config/routes.yaml old mode 100644 new mode 100755 index 41ef814..25bcff8 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -3,3 +3,4 @@ controllers: path: ../src/Controller/ namespace: App\Controller type: attribute + prefix: /kumora diff --git a/config/routes/framework.yaml b/config/routes/framework.yaml old mode 100644 new mode 100755 diff --git a/config/routes/security.yaml b/config/routes/security.yaml old mode 100644 new mode 100755 diff --git a/config/routes/web_profiler.yaml b/config/routes/web_profiler.yaml old mode 100644 new mode 100755 index 8d85319..b3498f0 --- a/config/routes/web_profiler.yaml +++ b/config/routes/web_profiler.yaml @@ -1,8 +1,8 @@ when@dev: web_profiler_wdt: - resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' - prefix: /_wdt + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + prefix: /kumora/_wdt web_profiler_profiler: - resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' - prefix: /_profiler + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + prefix: /kumora/_profiler diff --git a/config/services.yaml b/config/services.yaml old mode 100644 new mode 100755 diff --git a/importmap.php b/importmap.php old mode 100644 new mode 100755 diff --git a/migrations/.gitignore b/migrations/.gitignore old mode 100644 new mode 100755 diff --git a/migrations/Version20241229133017.php b/migrations/Version20241229133017.php old mode 100644 new mode 100755 diff --git a/phpunit.xml.dist b/phpunit.xml.dist old mode 100644 new mode 100755 diff --git a/public/.htaccess b/public/.htaccess new file mode 100755 index 0000000..ce3f7c2 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,73 @@ +# Use the front controller as index file. It serves as a fallback solution when +# every other rewrite/redirect fails (e.g. in an aliased environment without +# mod_rewrite). Additionally, this reduces the matching process for the +# start page (path "/") because otherwise Apache will apply the rewriting rules +# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). +DirectoryIndex index.php + +# By default, Apache does not evaluate symbolic links if you did not enable this +# feature in your server configuration. Uncomment the following line if you +# install assets as symlinks or if you experience problems related to symlinks +# when compiling LESS/Sass/CoffeScript assets. +# Options +SymLinksIfOwnerMatch + +# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve +# to the front controller "/index.php" but be rewritten to "/index.php/index". + + Options -MultiViews + + + + # This Option needs to be enabled for RewriteRule, otherwise it will show an error like + # 'Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden' + Options +SymLinksIfOwnerMatch + + RewriteEngine On + RewriteRule ^assets/(.*)$ assets/$1 [L] + # Determine the RewriteBase automatically and set it as environment variable. + # If you are using Apache aliases to do mass virtual hosting or installed the + # project in a subdirectory, the base path will be prepended to allow proper + # resolution of the index.php file and to redirect to the correct URI. It will + # work in environments without path prefix as well, providing a safe, one-size + # fits all solution. But as you do not need it in this case, you can comment + # the following 2 lines to eliminate the overhead. + RewriteCond %{ENV:BASE} ^/kumora(.+)$ + RewriteRule .* - [E=BASE:%1] + + RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$ + RewriteRule .* - [E=BASE:%1] + + # Sets the HTTP_AUTHORIZATION header removed by Apache + RewriteCond %{HTTP:Authorization} .+ + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0] + + # Redirect to URI without front controller to prevent duplicate content + # (with and without `/index.php`). Only do this redirect on the initial + # rewrite by Apache and not on subsequent cycles. Otherwise we would get an + # endless redirect loop (request -> rewrite to front controller -> + # redirect -> request -> ...). + # So in case you get a "too many redirects" error or you always get redirected + # to the start page because your Apache does not expose the REDIRECT_STATUS + # environment variable, you have 2 choices: + # - disable this feature by commenting the following 2 lines or + # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the + # following RewriteCond (best solution) + RewriteCond %{ENV:REDIRECT_STATUS} ="" + RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] + + # If the requested filename exists, simply serve it. + # We only want to let Apache serve files and not directories. + # Rewrite all other queries to the front controller. + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ %{ENV:BASE}/index.php [L] + + + + + # When mod_rewrite is not available, we instruct a temporary redirect of + # the start page to the front controller explicitly so that the website + # and the generated links can still be used. + RedirectMatch 307 ^/$ /index.php/ + # RedirectTemp cannot be used instead + + diff --git a/public/index.php b/public/index.php old mode 100644 new mode 100755 diff --git a/renovate.json b/renovate.json old mode 100644 new mode 100755 diff --git a/src/Command/CreateUserCommand.php b/src/Command/CreateUserCommand.php old mode 100644 new mode 100755 diff --git a/src/Controller/.gitignore b/src/Controller/.gitignore old mode 100644 new mode 100755 diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php old mode 100644 new mode 100755 diff --git a/src/Controller/FilesController.php b/src/Controller/FilesController.php old mode 100644 new mode 100755 diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php old mode 100644 new mode 100755 diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php old mode 100644 new mode 100755 index c4624b4..fd9800a --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -6,15 +6,21 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class SecurityController extends AbstractController { + public function __construct(private readonly UrlGeneratorInterface $urlGenerator) + { + } + #[Route(path: '/login', name: 'app_login')] public function login(AuthenticationUtils $authenticationUtils): Response { if ($this->isGranted('IS_AUTHENTICATED_FULLY')) { return $this->redirectToRoute('app_home'); } + // get the login error if there is one $error = $authenticationUtils->getLastAuthenticationError(); diff --git a/src/Entity/.gitignore b/src/Entity/.gitignore old mode 100644 new mode 100755 diff --git a/src/Entity/User.php b/src/Entity/User.php old mode 100644 new mode 100755 diff --git a/src/Form/.gitkeep b/src/Form/.gitkeep old mode 100644 new mode 100755 diff --git a/src/Form/UserAdminType.php b/src/Form/UserAdminType.php old mode 100644 new mode 100755 diff --git a/src/Kernel.php b/src/Kernel.php old mode 100644 new mode 100755 diff --git a/src/Repository/.gitignore b/src/Repository/.gitignore old mode 100644 new mode 100755 diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php old mode 100644 new mode 100755 diff --git a/src/Security/Authentication/AuthenticationSuccessHandler.php b/src/Security/Authentication/AuthenticationSuccessHandler.php new file mode 100644 index 0000000..6ee26fa --- /dev/null +++ b/src/Security/Authentication/AuthenticationSuccessHandler.php @@ -0,0 +1,23 @@ +urlGenerator->generate('app_home'); + return new RedirectResponse($url); + } +} \ No newline at end of file diff --git a/src/Twig/Extension/BasenameExtension.php b/src/Twig/Extension/BasenameExtension.php old mode 100644 new mode 100755 diff --git a/src/Twig/Extension/SizeExtension.php b/src/Twig/Extension/SizeExtension.php old mode 100644 new mode 100755 diff --git a/src/Twig/Extension/TimeExtension.php b/src/Twig/Extension/TimeExtension.php old mode 100644 new mode 100755 diff --git a/src/Twig/Runtime/BasenameExtensionRuntime.php b/src/Twig/Runtime/BasenameExtensionRuntime.php old mode 100644 new mode 100755 diff --git a/src/Twig/Runtime/SizeExtensionRuntime.php b/src/Twig/Runtime/SizeExtensionRuntime.php old mode 100644 new mode 100755 diff --git a/src/Twig/Runtime/TimeExtensionRuntime.php b/src/Twig/Runtime/TimeExtensionRuntime.php old mode 100644 new mode 100755 diff --git a/symfony.lock b/symfony.lock old mode 100644 new mode 100755 index 584596b..19500ec --- a/symfony.lock +++ b/symfony.lock @@ -52,6 +52,18 @@ "tests/bootstrap.php" ] }, + "symfony/apache-pack": { + "version": "1.0", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.0", + "ref": "0f18b4decdf5695d692c1d0dfd65516a07a6adf1" + }, + "files": [ + "public/.htaccess" + ] + }, "symfony/asset-mapper": { "version": "7.2", "recipe": { diff --git a/tailwind.config.js b/tailwind.config.js old mode 100644 new mode 100755 diff --git a/templates/admin/index.html.twig b/templates/admin/index.html.twig old mode 100644 new mode 100755 diff --git a/templates/admin/user_edit.html.twig b/templates/admin/user_edit.html.twig old mode 100644 new mode 100755 diff --git a/templates/admin/user_index.html.twig b/templates/admin/user_index.html.twig old mode 100644 new mode 100755 diff --git a/templates/base-admin.html.twig b/templates/base-admin.html.twig old mode 100644 new mode 100755 diff --git a/templates/base.html.twig b/templates/base.html.twig old mode 100644 new mode 100755 diff --git a/templates/files/index.html.twig b/templates/files/index.html.twig old mode 100644 new mode 100755 diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig old mode 100644 new mode 100755 diff --git a/templates/partials/alerts.html.twig b/templates/partials/alerts.html.twig old mode 100644 new mode 100755 diff --git a/templates/partials/breadbrumb.html.twig b/templates/partials/breadbrumb.html.twig old mode 100644 new mode 100755 diff --git a/templates/partials/navbar-admin.html.twig b/templates/partials/navbar-admin.html.twig old mode 100644 new mode 100755 diff --git a/templates/partials/navbar.html.twig b/templates/partials/navbar.html.twig old mode 100644 new mode 100755 diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig old mode 100644 new mode 100755 diff --git a/tests/bootstrap.php b/tests/bootstrap.php old mode 100644 new mode 100755 diff --git a/translations/.gitignore b/translations/.gitignore old mode 100644 new mode 100755 diff --git a/uploads/.gitkeep b/uploads/.gitkeep old mode 100644 new mode 100755