diff --git a/app/Http/Controllers/Front/HomeController.php b/app/Http/Controllers/Front/HomeController.php deleted file mode 100644 index f4397233..00000000 --- a/app/Http/Controllers/Front/HomeController.php +++ /dev/null @@ -1,19 +0,0 @@ -where('status', PageStatusEnum::published); + + $dynamicPages = []; + + foreach ($dynamicPageModels as $dynamicPageModel) { + $pascalCase = str_replace(' ', '', ucwords(str_replace('-', ' ', $dynamicPageModel->id_key))); + $dynamicPages["page{$pascalCase}"] = $dynamicPageModel; + } + + + $props = [ ...InertiaHelper::errorProps(parent::share($request)), + 'recaptchaKey' => config('services.google.recaptcha.public'), + 'dynamicPages' => $dynamicPages, // More props here. ]; diff --git a/composer.json b/composer.json index 10ff0267..2ae1516a 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "laravel/tinker": "^2.10.1", "monolog/monolog": "^3.0", "psr/log": "^3.0", + "sentry/sentry-laravel": "^4.25", "tightenco/ziggy": "^2.5", "uwil/laravel-backend": "^4.0", "uwil/laravel-common": "^5.1", diff --git a/composer.lock b/composer.lock index e8a91020..28ccc778 100644 --- 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": "e466df5c08b26c991f1c808c0cf2d231", + "content-hash": "f41d07cc1caa32fe50011628872b6e76", "packages": [ { "name": "24slides/laravel-saml2", @@ -4252,16 +4252,16 @@ }, { "name": "sentry/sentry-laravel", - "version": "4.24.0", + "version": "4.25.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "f823bd85e38e06cb4f1b7a82d48a2fc95320b31d" + "reference": "6699c9465df6bee07d82279f7a209db941913456" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/f823bd85e38e06cb4f1b7a82d48a2fc95320b31d", - "reference": "f823bd85e38e06cb4f1b7a82d48a2fc95320b31d", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/6699c9465df6bee07d82279f7a209db941913456", + "reference": "6699c9465df6bee07d82279f7a209db941913456", "shasum": "" }, "require": { @@ -4327,7 +4327,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/4.24.0" + "source": "https://github.com/getsentry/sentry-laravel/tree/4.25.0" }, "funding": [ { @@ -4339,7 +4339,7 @@ "type": "custom" } ], - "time": "2026-03-24T10:33:54+00:00" + "time": "2026-04-07T12:55:27+00:00" }, { "name": "spatie/laravel-package-tools", @@ -7471,16 +7471,16 @@ }, { "name": "uwil/laravel-dynamic-pages", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "git@lab.s-web.fr:ldc-web/projets/laravel-dynamic-pages.git", - "reference": "24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d" + "reference": "299e024107fcc0649da2d9d6653e789842cc0d45" }, "dist": { "type": "zip", - "url": "https://lab.s-web.fr/api/v4/projects/250/packages/composer/archives/uwil/laravel-dynamic-pages.zip?sha=24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d", - "reference": "24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d", + "url": "https://lab.s-web.fr/api/v4/projects/250/packages/composer/archives/uwil/laravel-dynamic-pages.zip?sha=299e024107fcc0649da2d9d6653e789842cc0d45", + "reference": "299e024107fcc0649da2d9d6653e789842cc0d45", "shasum": "" }, "require": { diff --git a/config/laravellocalization.php b/config/laravellocalization.php index 40e2e5be..8ebc4ee0 100644 --- a/config/laravellocalization.php +++ b/config/laravellocalization.php @@ -37,7 +37,7 @@ return [ //'cy' => ['name' => 'Welsh', 'script' => 'Latn', 'native' => 'Cymraeg', 'regional' => 'cy_GB'], //'da' => ['name' => 'Danish', 'script' => 'Latn', 'native' => 'dansk', 'regional' => 'da_DK'], //'se' => ['name' => 'Northern Sami', 'script' => 'Latn', 'native' => 'davvisámegiella', 'regional' => 'se_NO'], - 'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'], + //'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'], //'luo' => ['name' => 'Luo', 'script' => 'Latn', 'native' => 'Dholuo', 'regional' => ''], //'nv' => ['name' => 'Navajo', 'script' => 'Latn', 'native' => 'Diné bizaad', 'regional' => ''], //'dua' => ['name' => 'Duala', 'script' => 'Latn', 'native' => 'duálá', 'regional' => ''], @@ -49,7 +49,7 @@ return [ //'en-GB' => ['name' => 'British English', 'script' => 'Latn', 'native' => 'British English', 'regional' => 'en_GB'], //'en-CA' => ['name' => 'Canadian English', 'script' => 'Latn', 'native' => 'Canadian English', 'regional' => 'en_CA'], //'en-US' => ['name' => 'U.S. English', 'script' => 'Latn', 'native' => 'U.S. English', 'regional' => 'en_US'], - 'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'], + //'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'], //'eo' => ['name' => 'Esperanto', 'script' => 'Latn', 'native' => 'esperanto', 'regional' => ''], //'eu' => ['name' => 'Basque', 'script' => 'Latn', 'native' => 'euskara', 'regional' => 'eu_ES'], //'ewo' => ['name' => 'Ewondo', 'script' => 'Latn', 'native' => 'ewondo', 'regional' => ''], @@ -133,7 +133,7 @@ return [ //'mtr' => ['name' => 'Mewari', 'script' => 'Latn', 'native' => 'Mewari', 'regional' => ''], //'mua' => ['name' => 'Mundang', 'script' => 'Latn', 'native' => 'Mundang', 'regional' => ''], //'mi' => ['name' => 'Māori', 'script' => 'Latn', 'native' => 'Māori', 'regional' => 'mi_NZ'], - 'nl' => ['name' => 'Dutch', 'script' => 'Latn', 'native' => 'Nederlands', 'regional' => 'nl_NL'], + //'nl' => ['name' => 'Dutch', 'script' => 'Latn', 'native' => 'Nederlands', 'regional' => 'nl_NL'], //'nmg' => ['name' => 'Kwasio', 'script' => 'Latn', 'native' => 'ngumba', 'regional' => ''], //'yav' => ['name' => 'Yangben', 'script' => 'Latn', 'native' => 'nuasue', 'regional' => ''], //'nn' => ['name' => 'Norwegian Nynorsk', 'script' => 'Latn', 'native' => 'nynorsk', 'regional' => 'nn_NO'], @@ -145,7 +145,7 @@ return [ //'hz' => ['name' => 'Herero', 'script' => 'Latn', 'native' => 'Otjiherero', 'regional' => ''], //'uz-Latn' => ['name' => 'Uzbek (Latin)', 'script' => 'Latn', 'native' => 'oʼzbekcha', 'regional' => 'uz_UZ'], //'nds' => ['name' => 'Low German', 'script' => 'Latn', 'native' => 'Plattdüütsch', 'regional' => 'nds_DE'], - 'pl' => ['name' => 'Polish', 'script' => 'Latn', 'native' => 'polski', 'regional' => 'pl_PL'], + //'pl' => ['name' => 'Polish', 'script' => 'Latn', 'native' => 'polski', 'regional' => 'pl_PL'], //'pt' => ['name' => 'Portuguese', 'script' => 'Latn', 'native' => 'português', 'regional' => 'pt_PT'], //'pt-BR' => ['name' => 'Brazilian Portuguese', 'script' => 'Latn', 'native' => 'português do Brasil', 'regional' => 'pt_BR'], //'ff' => ['name' => 'Fulah', 'script' => 'Latn', 'native' => 'Pulaar', 'regional' => 'ff_SN'], diff --git a/config/sentry.php b/config/sentry.php new file mode 100644 index 00000000..81860abd --- /dev/null +++ b/config/sentry.php @@ -0,0 +1,61 @@ + env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), + + // The release version of your application. + // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')). + 'release' => env('SENTRY_RELEASE'), + + // When left empty or `null` the Laravel environment will be used. + 'environment' => env('SENTRY_ENVIRONMENT'), + + 'breadcrumbs' => [ + // Capture Laravel logs in breadcrumbs. + 'logs' => true, + + // Capture SQL queries in breadcrumbs. + 'sql_queries' => true, + + // Capture bindings on SQL queries logged in breadcrumbs. + 'sql_bindings' => false, + + // Capture queue job information in breadcrumbs. + 'queue_info' => true, + + // Capture command information in breadcrumbs. + 'command_info' => true, + ], + + 'tracing' => [ + // Trace queue jobs as their own transactions. + 'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false), + + // Capture queue jobs as spans when executed on the sync driver. + 'queue_jobs' => true, + + // Capture SQL queries as spans. + 'sql_queries' => true, + + // Try to find out where the SQL query originated from and add it to the query spans. + 'sql_origin' => true, + + // Capture views as spans. + 'views' => true, + + // Indicates if the tracing integrations supplied by Sentry should be loaded. + 'default_integrations' => true, + + // Indicates that requests without a matching route should be traced. + 'missing_routes' => false, + ], + + // See: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#send-default-pii. + 'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false), + + // See: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate. + 'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_TRACES_SAMPLE_RATE'), + + 'before_send' => [\Uwil\LaravelCommon\Helpers\ExceptionsHelper::class, 'sentryEventHandler'], +]; diff --git a/config/services.php b/config/services.php index db17a967..12df8ee2 100644 --- a/config/services.php +++ b/config/services.php @@ -35,4 +35,11 @@ return [ ], ], + 'google' => [ + 'recaptcha' => [ + 'public' => env('GOOGLE_RECAPTCHA_PUBLIC'), + 'private' => env('GOOGLE_RECAPTCHA_PRIVATE'), + 'version' => env('GOOGLE_RECAPTCHA_VERSION', "3") === "3" ? true : false + ] + ], ]; diff --git a/docs/recaptcha/RECAPTCHA.md b/docs/recaptcha/RECAPTCHA.md new file mode 100644 index 00000000..ef904028 --- /dev/null +++ b/docs/recaptcha/RECAPTCHA.md @@ -0,0 +1,56 @@ +# Guide d'utilisation du système ReCaptcha Provider + +Ce guide explique comment utiliser notre système ReCaptcha basé sur un **Provider** et un hook React, pour simplifier l'intégration de Google reCAPTCHA avec gestion des cookies. + +--- + +## 1. Structure du système + +Le système se compose de trois éléments principaux : + +1. **`RecaptchaProvider`** + - Encapsule votre formulaire et active le reCAPTCHA automatiquement selon le statut des cookies. + - Fournit un contexte React (`useRecaptcha`) pour accéder au token et au `formRef`. + +2. **`useRecaptcha`** + - Hook React pour accéder au contexte du Provider. + - Fournit : + - `enabled` : booléen indiquant si le reCAPTCHA est actif (cookie accepté). + - `getToken()` : fonction pour récupérer le token reCAPTCHA actuel. + - `formRef` : référence au formulaire pour manipulation ou focus. + +3. **`RecaptchaForm`** + - Wrapper autour du `