Compare commits

..

6 commits

Author SHA1 Message Date
Olivier Legat
d0c8b42eb6 fix direct access with non fr navigator 2022-11-16 18:14:26 +01:00
Vincent BRIDIER
20d1188e87
Merge branch 'trunk' 2022-11-16 10:52:08 +01:00
Vincent BRIDIER
564fbf424e
Merge branch 'develop' into trunk 2022-11-16 10:51:57 +01:00
Vincent BRIDIER
1028507a53
Merge branch 'trunk' 2022-11-16 09:22:08 +01:00
Vincent BRIDIER
280285caef
Merge branch 'develop' into trunk 2022-11-16 09:21:42 +01:00
Vincent BRIDIER
d97aac17a9
Merge remote-tracking branch 'origin/hotfix' 2022-09-22 13:41:48 +02:00
41 changed files with 10563 additions and 5305 deletions

View file

@ -1,2 +0,0 @@
.git
*.md

View file

@ -31,17 +31,11 @@ MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
MAIL_LIST_SERVICEWEB=
MAIL_LIST_CONTACTFORM=
ANALYTICS_GOOGLE_ID=
# Google Recaptcha
GOOGLE_RECAPTCHA_PUBLIC=
GOOGLE_RECAPTCHA_PRIVATE=
GOOGLE_RECAPTCHA_VERSION=
## LDCWEB ADMIN SECURE
LDC_WEB_API_KEY=
# Sentry
SENTRY_LARAVEL_DSN=
LDC_WEB_API_KEY="MY_KEY"
LDC_STATUS_CHECKER_API_KEY="MY_KEY"
LDC_STATUS_CHECKER_UUID="UUID_PROJECT"

View file

@ -1,23 +1,74 @@
include:
- project: "ldc-web/shared-ci"
ref: "main"
file: "lint/lint7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "security/security7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "build/build7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "test/test.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "deploy/deploy.yml"
stages:
- lint
- security
- build
- test
- deploy
- Security
- CodingStandards
- Builds
composer-security:
stage: Security
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
script:
- local-php-security-checker --format=json --path=./composer.lock > composer-security-checker-report.json
artifacts:
when: on_failure
expose_as: 'composer-security-checker'
paths:
- composer-security-checker-report.json
allow_failure: true
needs: []
npm-security:
stage: Security
image: node:17.9.1
before_script:
- npm install --location=global audit-ci@^6
script:
- audit-ci -p npm -o json > npm-security-checker-report.json
artifacts:
when: on_failure
expose_as: 'npm-security-checker'
paths:
- npm-security-checker-report.json
allow_failure: true
needs: []
phpcs:
stage: CodingStandards
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
before_script:
- composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
- composer install
cache:
paths:
- vendor/
script:
- vendor/bin/phpcs --report=junit --report-file=phpcs-report.xml
artifacts:
when: on_failure
expose_as: 'phpcs'
paths:
- phpcs-report.xml
reports:
junit: phpcs-report.xml
allow_failure: false
needs:
- composer-security
- npm-security
front-build:
stage: Builds
image: node:17.9.1
before_script:
- npm install
cache:
paths:
- node_modules/
script:
- npm run prod > front-build-report.json
artifacts:
when: on_failure
expose_as: 'front-build-report'
paths:
- front-build-report.json
allow_failure: false
needs:
- phpcs

30
.vscode/settings.json vendored
View file

@ -1,23 +1,21 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#e2bd2b",
"activityBar.activeBackground": "#fccf1d",
"activityBar.activeBorder": "#222f5c",
"activityBar.background": "#e2bd2b",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#138c74",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#e2bd2b",
"activityBar.background": "#fccf1d",
"activityBar.foreground": "#222f5c",
"activityBar.inactiveForeground": "#222f5c99",
"activityBarBadge.background": "#ff0400",
"activityBarBadge.foreground": "#ffffff",
"sash.hoverBorder": "#fccf1d",
"statusBar.background": "#c19f1a",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#947a14",
"statusBar.foreground": "#222f5c",
"statusBarItem.hoverBackground": "#ff0400",
"statusBarItem.remoteBackground": "#c19f1a",
"statusBarItem.remoteForeground": "#15202b",
"statusBarItem.remoteForeground": "#222f5c",
"titleBar.activeBackground": "#c19f1a",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#c19f1a99",
"titleBar.inactiveForeground": "#15202b99",
"commandCenter.border": "#15202b99"
},
"peacock.remoteColor": "#c19f1a"
"titleBar.activeForeground": "#222f5c",
"titleBar.inactiveBackground": "#fccf1d99",
"titleBar.inactiveForeground": "#222f5c99"
}
}

View file

@ -1,5 +0,0 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-7.3:latest
COPY --chown=www-data:www-data . /app/srcs
USER root
RUN chmod -R 755 /app/srcs/storage
USER www-data

View file

@ -17,16 +17,6 @@ Pour le front :
npm install
npm run prod
```
## Traduction ([joedixon]([#table-of-contents](https://github.com/joedixon/laravel-translation)))
Publier la configuration :
```
php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"
```
Synchroniser les traductions entre les conducteurs :
```
php artisan translation:sync-translations
```
## Crons
Put every min in PROD :

View file

@ -1,354 +0,0 @@
<?php
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self ain()
* @method static self aisne()
* @method static self allier()
* @method static self alpesDeHauteProvence()
* @method static self hautesAlpes()
* @method static self alpesMaritimes()
* @method static self ardeche()
* @method static self ardennes()
* @method static self ariege()
* @method static self aube()
* @method static self aude()
* @method static self aveyron()
* @method static self bouchesDuRhone()
* @method static self calvados()
* @method static self cantal()
* @method static self charenteeme()
* @method static self charenteMaritime()
* @method static self cher()
* @method static self correze()
* @method static self corseDuSud()
* @method static self hauteCorse()
* @method static self coteDor()
* @method static self cotesDarmor()
* @method static self creuse()
* @method static self dordogne()
* @method static self doubs()
* @method static self drome()
* @method static self eure()
* @method static self eureEtLoir()
* @method static self finistere()
* @method static self gard()
* @method static self hauteGaronne()
* @method static self gers()
* @method static self gironde()
* @method static self herault()
* @method static self illeEtVilaine()
* @method static self indre()
* @method static self indreEtLoire()
* @method static self isere()
* @method static self jura()
* @method static self landes()
* @method static self loirEtCher()
* @method static self loire()
* @method static self hauteLoire()
* @method static self loireAtlantique()
* @method static self loiret()
* @method static self lot()
* @method static self lotEtGaronne()
* @method static self lozere()
* @method static self maineEtLoire()
* @method static self manche()
* @method static self marne()
* @method static self hauteMarne()
* @method static self mayenne()
* @method static self meurtheEtMoselle()
* @method static self meuse()
* @method static self morbihan()
* @method static self moselle()
* @method static self nievre()
* @method static self nord()
* @method static self oise()
* @method static self orne()
* @method static self pasDeCalais()
* @method static self puyDeDome()
* @method static self pyreneesAtlantiques()
* @method static self hautesPyrenees()
* @method static self pyreneesOrientales()
* @method static self basRhin()
* @method static self hautRhin()
* @method static self rhone()
* @method static self hauteSaone()
* @method static self saoneEtLoire()
* @method static self sarthe()
* @method static self savoie()
* @method static self hauteSavoie()
* @method static self paris()
* @method static self seineMaritime()
* @method static self seineEtMarne()
* @method static self yvelines()
* @method static self deuxSevres()
* @method static self somme()
* @method static self tarn()
* @method static self tarnEtGaronne()
* @method static self var()
* @method static self vaucluse()
* @method static self vendee()
* @method static self vienne()
* @method static self hauteVienne()
* @method static self vosges()
* @method static self yonne()
* @method static self territoireDeBelfort()
* @method static self essonne()
* @method static self hautsDeSeine()
* @method static self seineSaintDenis()
* @method static self valDeMarne()
* @method static self valDoise()
* @method static self guadeloupe()
* @method static self martinique()
* @method static self guyane()
* @method static self laReunion()
* @method static self saintPierreEtMiquelon()
* @method static self mayotte()
* @method static self saintBarthelemy()
* @method static self saintMartin()
* @method static self wallisEtFutuna()
* @method static self polynesieFrancaise()
* @method static self nouvelleCaledonie()
* @package App\Enums
*/
class Department extends BaseEnumRoutable
{
/**
* Enum values
*
* @return array<string>
*/
protected static function values(): array
{
return [
'ain' => 1,
'aisne' => 2,
'allier' => 3,
'alpesDeHauteProvence' => 4,
'hautesAlpes' => 5,
'alpesMaritimes' => 6,
'ardeche' => 7,
'ardennes' => 8,
'ariege' => 9,
'aube' => 10,
'aude' => 11,
'aveyron' => 12,
'bouchesDuRhone' => 13,
'calvados' => 14,
'cantal' => 15,
'charenteeme' => 16,
'charenteMaritime' => 17,
'cher' => 18,
'correze' => 19,
'corseDuSud' => '2A',
'hauteCorse' => '2B',
'coteDor' => 21,
'cotesDarmor' => 22,
'creuse' => 23,
'dordogne' => 24,
'doubs' => 25,
'drome' => 26,
'eure' => 27,
'eureEtLoir' => 28,
'finistere' => 29,
'gard' => 30,
'hauteGaronne' => 31,
'gers' => 32,
'gironde' => 33,
'herault' => 34,
'illeEtVilaine' => 35,
'indre' => 36,
'indreEtLoire' => 37,
'isere' => 38,
'jura' => 39,
'landes' => 40,
'loirEtCher' => 41,
'loire' => 42,
'hauteLoire' => 43,
'loireAtlantique' => 44,
'loiret' => 45,
'lot' => 46,
'lotEtGaronne' => 47,
'lozere' => 48,
'maineEtLoire' => 49,
'manche' => 50,
'marne' => 51,
'hauteMarne' => 52,
'mayenne' => 53,
'meurtheEtMoselle' => 54,
'meuse' => 55,
'morbihan' => 56,
'moselle' => 57,
'nievre' => 58,
'nord' => 59,
'oise' => 60,
'orne' => 61,
'pasDeCalais' => 62,
'puyDeDome' => 63,
'pyreneesAtlantiques' => 64,
'hautesPyrenees' => 65,
'pyreneesOrientales' => 66,
'basRhin' => 67,
'hautRhin' => 68,
'rhone' => 69,
'hauteSaone' => 70,
'saoneEtLoire' => 71,
'sarthe' => 72,
'savoie' => 73,
'hauteSavoie' => 74,
'paris' => 75,
'seineMaritime' => 76,
'seineEtMarne' => 77,
'yvelines' => 78,
'deuxSevres' => 79,
'somme' => 80,
'tarn' => 81,
'tarnEtGaronne' => 82,
'var' => 83,
'vaucluse' => 84,
'vendee' => 85,
'vienne' => 86,
'hauteVienne' => 87,
'vosges' => 88,
'yonne' => 89,
'territoireDeBelfort' => 90,
'essonne' => 91,
'hautsDeSeine' => 92,
'seineSaintDenis' => 93,
'valDeMarne' => 94,
'valDoise' => 95,
'guadeloupe' => 971,
'martinique' => 972,
'guyane' => 973,
'laReunion' => 974,
'saintPierreEtMiquelon' => 975,
'mayotte' => 976,
'saintBarthelemy' => 977,
'saintMartin' => 978,
'wallisEtFutuna' => 986,
'polynesieFrancaise' => 987,
'nouvelleCaledonie' => 988
];
}
/**
* Enum labels
*
* @return array<string>
*/
protected static function labels(): array
{
return [
'ain' => 'Ain',
'aisne' => 'Aisne',
'allier' => 'Allier',
'alpesDeHauteProvence' => 'Alpes-de-Haute-Provence',
'hautesAlpes' => 'Hautes-alpes',
'alpesMaritimes' => 'Alpes-maritimes',
'ardeche' => 'Ardèche',
'ardennes' => 'Ardennes',
'ariege' => 'Ariège',
'aube' => 'Aube',
'aude' => 'Aude',
'aveyron' => 'Aveyron',
'bouchesDuRhone' => 'Bouches-du-Rhône',
'calvados' => 'Calvados',
'cantal' => 'Cantal',
'charenteeme' => 'Charenteême',
'charenteMaritime' => 'Charente-maritime',
'cher' => 'Cher',
'correze' => 'Corrèze',
'corseDuSud' => 'Corse-du-sud',
'hauteCorse' => 'Haute-Corse',
'coteDor' => 'Côte-d\'Or',
'cotesDarmor' => 'Côtes-d\'Armor',
'creuse' => 'Creuse',
'dordogne' => 'Dordogne',
'doubs' => 'Doubs',
'drome' => 'Drôme',
'eure' => 'Eure',
'eureEtLoir' => 'Eure-et-loir',
'finistere' => 'Finistère',
'gard' => 'Gard',
'hauteGaronne' => 'Haute-garonne',
'gers' => 'Gers',
'gironde' => 'Gironde',
'herault' => 'Hérault',
'illeEtVilaine' => 'Ille-et-vilaine',
'indre' => 'Indre',
'indreEtLoire' => 'Indre-et-loire',
'isere' => 'Isère',
'jura' => 'Jura',
'landes' => 'Landes',
'loirEtCher' => 'Loir-et-cher',
'loire' => 'Loire',
'hauteLoire' => 'Haute-loire',
'loireAtlantique' => 'Loire-atlantique',
'loiret' => 'Loiret',
'lot' => 'Lot',
'lotEtGaronne' => 'Lot-et-garonne',
'lozere' => 'Lozère',
'maineEtLoire' => 'Maine-et-loire',
'manche' => 'Manche',
'marne' => 'Marne',
'hauteMarne' => 'Haute-marne',
'mayenne' => 'Mayenne',
'meurtheEtMoselle' => 'Meurthe-et-moselle',
'meuse' => 'Meuse',
'morbihan' => 'Morbihan',
'moselle' => 'Moselle',
'nievre' => 'Nièvre',
'nord' => 'Nord',
'oise' => 'Oise',
'orne' => 'Orne',
'pasDeCalais' => 'Pas-de-calais',
'puyDeDome' => 'Puy-de-dôme',
'pyreneesAtlantiques' => 'Pyrénées-atlantiques',
'hautesPyrenees' => 'Hautes-Pyrénées',
'pyreneesOrientales' => 'Pyrénées-orientales',
'basRhin' => 'Bas-rhin',
'hautRhin' => 'Haut-rhin',
'rhone' => 'Rhône',
'hauteSaone' => 'Haute-saône',
'saoneEtLoire' => 'Saône-et-loire',
'sarthe' => 'Sarthe',
'savoie' => 'Savoie',
'hauteSavoie' => 'Haute-savoie',
'paris' => 'Paris',
'seineMaritime' => 'Seine-maritime',
'seineEtMarne' => 'Seine-et-marne',
'yvelines' => 'Yvelines',
'deuxSevres' => 'Deux-sèvres',
'somme' => 'Somme',
'tarn' => 'Tarn',
'tarnEtGaronne' => 'Tarn-et-Garonne',
'var' => 'Var',
'vaucluse' => 'Vaucluse',
'vendee' => 'Vendée',
'vienne' => 'Vienne',
'hauteVienne' => 'Haute-vienne',
'vosges' => 'Vosges',
'yonne' => 'Yonne',
'territoireDeBelfort' => 'Territoire de belfort',
'essonne' => 'Essonne',
'hautsDeSeine' => 'Hauts-de-seine',
'seineSaintDenis' => 'Seine-Saint-Denis',
'valDeMarne' => 'Val-de-marne',
'valDoise' => 'Val-d\'Oise',
'guadeloupe' => 'Guadeloupe',
'martinique' => 'Martinique',
'guyane' => 'Guyane',
'laReunion' => 'La réunion',
'saintPierreEtMiquelon' => 'Saint-Pierre-et-Miquelon',
'mayotte' => 'Mayotte',
'saintBarthelemy' => 'Saint-Barthélemy',
'saintMartin' => 'Saint-Martin',
'wallisEtFutuna' => 'Wallis-et-Futuna',
'polynesieFrancaise' => 'Polynésie-française',
'nouvelleCaledonie' => 'Nouvelle-Calédonie',
];
}
}

View file

@ -13,7 +13,7 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
/**
* Undocumented class
@ -43,17 +43,4 @@ class Handler extends ExceptionHandler
'password',
'password_confirmation',
];
/**
* Register
* @return void
*/
public function register()
{
$this->reportable(function (\Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
}

View file

@ -2,12 +2,9 @@
namespace App\Http\Controllers;
use App\Enums\Country;
use App\Enums\Department;
use App\Http\Requests\ContactFormRequest;
use App\Mail\SendContactMail;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Cache;
class ContactController extends Controller
{
@ -18,15 +15,7 @@ class ContactController extends Controller
*/
public function contact()
{
$listCountries = Cache::remember('listCountries', 86400, function () {
return Country::toArray();
});
$listDeps = Cache::remember('listDeps', 86400, function () {
return Department::toArray();
});
return view('front.contact', compact('listCountries', 'listDeps'));
return view('front.contact');
}
/**
@ -37,14 +26,7 @@ class ContactController extends Controller
*/
public function contactSubmit(ContactFormRequest $request)
{
$data = \collect($request->validated());
$data->put('country', Country::make(intval($request->post('country')))->label);
if ($request->post('department')) {
$data->put('departement', Department::make(intval($request->post('departement')))->label);
}
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($data->all()));
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($request->validated()));
$lang = session()->get('lang', config('app.locale'));
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")

View file

@ -6,10 +6,19 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use App\Enums\Country;
class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
/**
* Perform any actions required when creating the object.
*/
public function __construct()
{
view()->share('availableCountries', Country::toArray());
}
}

View file

@ -39,7 +39,6 @@ class Kernel extends HttpKernel
'lang-check',
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\SecureHeaders::class
],
'api' => [

View file

@ -1,102 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\View;
class SecureHeaders
{
/**
* Enumerate headers which you do not want in your application's responses.
* Great starting point would be to go check out @Scott_Helme's:
* https://securityheaders.com/
*
* @var array
*/
private $unwantedHeaderList = [
'X-Powered-By',
'Server',
];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
View::share('nonce', $nonce = \uniqid());
// * For VueJS dev tool to execute
$jsDev = config('app.debug') ? "'unsafe-eval' 'unsafe-inline'" : "'nonce-$nonce'";
$reportUri = Route::has('cspReportUri') ?
\sprintf('report-uri %s', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
$this->removeUnwantedHeaders($this->unwantedHeaderList);
$response = $next($request);
$response->headers->set('Referrer-Policy', 'no-referrer-when-downgrade');
$response->headers->set('X-Content-Type-Options', 'nosniff');
$response->headers->set('X-XSS-Protection', '1; mode=block');
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
$response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains;');
$cspPolicies = [
// "default-src 'none';",
"manifest-src 'self';",
"connect-src 'self' blob: " . \implode(' ', [
'https://*.google-analytics.com',
'https://*.analytics.google.com',
'https://*.googletagmanager.com',
'https://*.g.doubleclick.net',
'https://*.google.com',
]) . ';',
"img-src * data: blob: " . \implode(' ', [
'https://*.google-analytics.com',
'https://*.analytics.google.com',
'https://*.googletagmanager.com',
'https://*.g.doubleclick.net',
'https://*.google.com',
]) . ';',
'frame-src ' . implode(' ', [
'https://www.google.com/recaptcha/',
'https://recaptcha.google.com/recaptcha/',
]),
// "font-src 'self' data:;",
// ! Using CKEditor will must have unsafe-inline style
// phpcs:ignore Generic.Files.LineLength.TooLong
"style-src 'self' 'unsafe-inline';",
// ! If you dont use ckeditor use this
// "style-src 'self' 'nonce-$nonce';",
// phpcs:ignore Generic.Files.LineLength.TooLong
'script-src ' . implode(" ", [
'\'self\'',
'https://www.google.com/recaptcha/',
'https://www.gstatic.com/recaptcha/',
'https://*.googletagmanager.com',
'https://cdn.ckeditor.com',
'https://cdn.jsdelivr.net',
]) . ' ' . $jsDev . ';'
];
$response->headers->set(
'Content-Security-Policy',
implode(' ', $cspPolicies) . $reportUri
);
$response->headers->set('Feature-Policy', 'fullscreen \'self\';');
return $response;
}
/**
* Remove unwanted headers
*
* @param array $headerList
* @return void
*/
private function removeUnwantedHeaders(array $headerList)
{
foreach ($headerList as $header) {
header_remove($header);
}
}
}

View file

@ -2,11 +2,7 @@
namespace App\Http\Requests;
use App\Enums\Country;
use App\Enums\Department;
use App\Lib\Helpers\ToolboxHelper;
use Illuminate\Foundation\Http\FormRequest;
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
class ContactFormRequest extends FormRequest
{
@ -27,8 +23,6 @@ class ContactFormRequest extends FormRequest
*/
public function rules()
{
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
return [
'civilite' => 'required|in:monsieur,madame',
'name' => 'required|string|min:2',
@ -38,15 +32,8 @@ class ContactFormRequest extends FormRequest
'city' => 'required|string|max:255',
'phone' => 'required|numeric|min:1|max:9999999999',
'email' => 'required|email:rfc,dns,spoof|max:255',
'country' => [
'required',
new EnumIsValidRule(Country::class)
],
'departement' => [
'required_if:country,' . Country::france()->label,
'nullable',
new EnumIsValidRule(Department::class)
],
'country' => 'required|string|max:255',
'departement' => 'required_if:country,France|max:255',
'topic' => 'required',
'product_name' => 'required_if:topic,Réclamation|max:255',
'barcode' => 'required_if:topic,Réclamation|max:128',

View file

@ -1,190 +0,0 @@
<?php
namespace App\Lib\Helpers;
class ExceptionsHelper
{
/**
* Handle sentry event
*
* @param \Sentry\Event $event
* @return null|\Sentry\Event
*/
public static function sentryEventHandler(\Sentry\Event $event): ?\Sentry\Event
{
// Remove unwanted reports.
$event->setModules([]);
$event->setOsContext(null);
/** @var \Sentry\ExceptionDataBag[] */
$exceptionBag = [];
foreach ($event->getExceptions() as $exceptionDataBag) {
$exceptionBag[] = self::getAnonymizedSentryException($exceptionDataBag);
}
$event->setExceptions($exceptionBag);
return $event;
}
/**
* Anonimize Sentry Exception bag
*
* @param \Sentry\ExceptionDataBag $exceptionDataBag
* @return \Sentry\ExceptionDataBag
*/
private static function getAnonymizedSentryException(
\Sentry\ExceptionDataBag $exceptionDataBag
): \Sentry\ExceptionDataBag {
$exceptionDataBag->setValue(self::getAnonymizedMessage($exceptionDataBag->getValue()));
if ($stackTrace = $exceptionDataBag->getStacktrace()) {
$exceptionDataBag->setStacktrace(self::getAnonymizedSentryStackTrace($stackTrace));
}
return $exceptionDataBag;
}
/**
* Anonymise sentry stacktrace
*
* @param \Sentry\Stacktrace $stackTrace
* @return \Sentry\Stacktrace
*/
private static function getAnonymizedSentryStackTrace(\Sentry\Stacktrace $stackTrace): \Sentry\Stacktrace
{
/** @var \Sentry\Frame[] */
$frames = \array_reverse($stackTrace->getFrames(), true);
$i = \count($frames) - 1;
// * Remove all but keep first (index.php).
while ($i-- > 0) {
$stackTrace->removeFrame(count($stackTrace->getFrames()) - 1);
}
foreach ($frames as $index => $frame) {
$frame->setPostContext([]);
$frame->setPreContext([]);
$frame->setContextLine('');
$frame->setVars(self::getAnonymizedSentryParams($frame->getVars()));
$stackTrace->addFrame($frame);
if ($index === 0) {
$stackTrace->removeFrame(count($stackTrace->getFrames()) - 1);
}
}
return $stackTrace;
}
/**
* Get anonymized sentry params
*
* @param mixed[] $params
* @return string[]
*/
private static function getAnonymizedSentryParams(array $params): array
{
foreach ($params as &$param) {
$type = \strtolower(\gettype($param));
if (\is_string($param)) {
$type = \explode(' ', \trim($param))[0] ?? null;
}
switch ($type) {
case 'Lambda':
case 'Object':
continue 2;
case 'array':
$param = sprintf('Array(%d)', \count($param));
continue 2;
default:
if (\is_numeric($param)) {
$param = \ucfirst($type);
continue 2;
}
if (\is_string($param)) {
$param = sprintf('String(%d)', \strlen($param));
continue 2;
}
} //end switch
} //end foreach
return $params;
}
/**
* Anonymize at least Sql queries
*
* @param string $message
* @return string
*/
public static function getAnonymizedMessage(string $message): string
{
$message = \preg_replace('/^(.*)( \(SQL:.*\))$/', '$1', $message) ?? $message;
if ($sqlPos = \strpos($message, 'to use near')) {
$message = \mb_strcut($message, 0, $sqlPos);
}
return $message;
}
/**
* Anonymize stack trace
*
* @param \Throwable $e
* @return string
*/
public static function getAnonymizedStackTrace(\Throwable $e): string
{
$projectPath = \realpath(\sprintf('%s/../', \app_path()));
$traceStack = $e->getTrace();
$traceStr = '';
$maxStackStage = 0;
foreach ($traceStack as $stackStage => $stack) {
$maxStackStage = $stackStage;
$traceStr .= \sprintf(
'#%s %s(%d): ',
$stackStage,
str_replace($projectPath, '', $stack['file'] ?? ''),
$stack['line'] ?? ''
);
if (isset($stack['class'])) {
$traceStr .= "{$stack['class']}->{$stack['function']}(";
if (isset($stack['args'])) {
$traceStr .= self::handleArgs($stack);
}
$traceStr .= ")\n";
} elseif (isset($stack['function'])) {
$traceStr .= "{$stack['function']}(";
if (isset($stack['args'])) {
$traceStr .= self::handleArgs($stack);
}
$traceStr .= ")\n";
}
} //end foreach
$maxStackStage++;
$traceStr .= "#$maxStackStage {main}";
return $traceStr;
}
/**
* Handle Args
*
* @param array $stack
* @return string
*/
public static function handleArgs(array $stack): string
{
$traceArgs = '';
$argsCount = count($stack['args']);
for ($i = 0; $i < $argsCount; $i++) {
$type = \gettype($stack['args'][$i]);
switch ($type) {
case 'object':
$traceArgs .= sprintf('Object(%s)', \get_class($stack['args'][$i]));
break;
case 'array':
$traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i]));
break;
case 'string':
$traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i]));
break;
default:
$traceArgs .= \gettype($stack['args'][$i]);
}
$traceArgs .= ($i !== ($argsCount - 1) ? ',' : '');
}
return $traceArgs;
}
}

View file

@ -1,65 +0,0 @@
<?php
namespace App\Lib\Helpers;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Validator;
class ToolboxHelper
{
/**
* Validate recaptcha
*
* @param Request $request
* @param boolean $isV3
* @return void
*/
public static function validateRecaptcha(Request $request, bool $isV3 = true)
{
Validator::validate($request->all(), [
'g-recaptcha-response' => [
'required', 'string',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) use ($isV3) {
try {
$response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [
'secret' => config('services.google.recaptcha.private'),
'response' => \strval($value),
'remoteip' => app('clientIp')
]);
if ($e = $response->toException()) {
throw $e;
}
if ($isV3) {
if (
!$response->json('success') or
!$response->json('challenge_ts') or
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
!$response->json('score')
) {
throw new \RuntimeException();
}
if (\floatval($response->json('score')) < 0.8) {
$fail("Vous n'avez pas obtenu un score assez élevé lors de la validation du recaptcha");
}
return;
}
if (
!$response->json('success') or
!$response->json('challenge_ts') or
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST)
) {
throw new \RuntimeException();
}
} catch (\Exception $e) {
$fail('Erreur lors de la validation du formulaire veuillez réssayer');
} //end try
}
]
], [], ['g-recaptcha-response' => 'reCaptcha']);
}
}

View file

@ -7,6 +7,15 @@ use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
/**
* Bootstrap any application services.
*
@ -15,13 +24,5 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
URL::forceScheme('https');
// * HA PROXY FIX
app()->singleton('clientIp', function () {
if (config('app.env') === 'local') {
return request()->getClientIp();
}
return request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp();
});
}
}

View file

@ -1,7 +1,7 @@
{
"name": "uwil/doux",
"name": "laravel/laravel",
"type": "project",
"description": "Doux Website",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
@ -13,13 +13,14 @@
"guzzlehttp/guzzle": "^7.0.1",
"joedixon/laravel-translation": "^1.1",
"kwaadpepper/enum": "^2.1",
"kwaadpepper/exception-handler": "^0.0.9",
"kwaadpepper/refresh-sitemap": "^1.0",
"laravel/framework": "^8.65",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.3",
"ldc/web-admin-secure-laravel": "^1.0",
"ldc/web-admin-secure-laravel": "1.0.1",
"ldc/web-status-checker-laravel": "1.0.3",
"mews/purifier": "^3.3",
"sentry/sentry-laravel": "^4.1",
"spatie/laravel-translatable": "^4.6"
},
"require-dev": {
@ -69,17 +70,14 @@
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"gitlab-domains": [
"lab.s-web.fr"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": {
"lab.s-web.fr": {
"gitlab.com/16669037": {
"type": "composer",
"url": "https://lab.s-web.fr/api/v4/group/23/-/packages/composer/packages.json"
"url": "https://gitlab.com/api/v4/group/16669037/-/packages/composer/packages.json"
}
}
}

1948
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
<?php
return [
/**
* Send mail when app debug is turn off
* so you can be warned if an unhandled exception occurs
*/
'enableMaiLog' => !config('app.debug'),
/**
* Put a developper secured mailbox in here
* so you can receive email if things go mad
*/
'contactsList' => explode(",", env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr'))
];

View file

@ -113,22 +113,6 @@ return [
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'stdout' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDOUT_FORMATTER'),
'with' => [
'stream' => 'php://stdout',
],
],
'k8s' => [
'driver' => 'stack',
'channels' => ['daily', 'stdout'],
'ignore_exceptions' => false,
],
],
];

View file

@ -1,61 +0,0 @@
<?php
return [
'dsn' => 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' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
];

View file

@ -30,12 +30,4 @@ return [
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'google' => [
'recaptcha' => [
'public' => env('GOOGLE_RECAPTCHA_PUBLIC'),
'private' => env('GOOGLE_RECAPTCHA_PRIVATE'),
'version' => env('GOOGLE_RECAPTCHA_VERSION', "3") === "3" ? true : false
]
],
];

View file

@ -27,7 +27,7 @@ class UserFactory extends Factory
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
// Password is : password .
// Password is : password .
'remember_token' => Str::random(10),
];
}
@ -39,7 +39,7 @@ class UserFactory extends Factory
*/
public function unverified()
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,

View file

@ -1,175 +0,0 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ${CI_PROJECT_PATH_SLUG}-config-map
data:
APP_NAME: "${APP_APP_NAME}"
APP_ENV: "${APP_APP_ENV}"
APP_KEY: "${APP_APP_KEY}"
APP_DEBUG: "${APP_APP_DEBUG}"
APP_URL: "https://www.${APP_DOMAIN}"
LOG_CHANNEL: "k8s"
DB_HOST: "mariadb-service.common-services"
DB_DATABASE: "${APP_DB_DATABASE}"
DB_USERNAME: "${APP_DB_USERNAME}"
DB_PASSWORD: "${APP_DB_PASSWORD}"
MAIL_HOST: "${APP_MAIL_HOST}"
MAIL_PORT: "${APP_MAIL_PORT}"
MAIL_USERNAME: "${APP_MAIL_USERNAME}"
MAIL_PASSWORD: "${APP_MAIL_PASSWORD}"
MAIL_ENCRYPTION: "${APP_MAIL_ENCRYPTION}"
MAIL_FROM_ADDRESS: "${APP_MAIL_FROM_ADDRESS}"
MAIL_FROM_NAME: "${APP_APP_NAME}"
MAIL_LIST_CONTACTFORM: "${APP_MAIL_LIST_CONTACTFORM}"
LDC_WEB_API_KEY: "${APP_LDC_WEB_API_KEY}"
GOOGLE_RECAPTCHA_PRIVATE: "${APP_GOOGLE_RECAPTCHA_PRIVATE}"
GOOGLE_RECAPTCHA_PUBLIC: "${APP_GOOGLE_RECAPTCHA_PUBLIC}"
GOOGLE_RECAPTCHA_VERSION: "${APP_GOOGLE_RECAPTCHA_VERSION}"
ANALYTICS_GOOGLE_ID: "${APP_ANALYTICS_GOOGLE_ID}"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ${CI_PROJECT_PATH_SLUG}-pvc-storage
spec:
storageClassName: "csi-cinder-classic"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: $APP_PVC_SIZE
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${CI_PROJECT_PATH_SLUG}-deployment
spec:
replicas: 1
selector:
matchLabels:
app: ${CI_PROJECT_PATH_SLUG}-app
template:
metadata:
labels:
app: ${CI_PROJECT_PATH_SLUG}-app
spec:
containers:
- name: ${CI_PROJECT_PATH_SLUG}-container
image: $IMAGE_TAG
envFrom:
- configMapRef:
name: ${CI_PROJECT_PATH_SLUG}-config-map
volumeMounts:
- name: storage
mountPath: /app/srcs/storage
imagePullSecrets:
- name: docker-registry-credentials
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
volumes:
- name: storage
persistentVolumeClaim:
claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage
---
apiVersion: v1
kind: Service
metadata:
name: ${CI_PROJECT_PATH_SLUG}-service
spec:
selector:
app: ${CI_PROJECT_PATH_SLUG}-app
ports:
- port: 80
targetPort: 443
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: ${CI_PROJECT_PATH_SLUG}-ingress-route
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`${APP_DOMAIN}`, `www.${APP_DOMAIN}`)
kind: Rule
services:
- name: ${CI_PROJECT_PATH_SLUG}-service
port: 80
middlewares:
- name: redirect-no-www-to-www
namespace: common-services
tls:
secretName: $APP_DOMAIN
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: $APP_DOMAIN
spec:
dnsNames:
- $APP_DOMAIN
- www.${APP_DOMAIN}
secretName: $APP_DOMAIN
issuerRef:
name: $APP_CERT_ISSUER
kind: ClusterIssuer
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: ${CI_PROJECT_PATH_SLUG}-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ${CI_PROJECT_PATH_SLUG}-app
topologyKey: "kubernetes.io/hostname"
namespaces: [$KUBE_NAMESPACE]
containers:
- name: ${CI_PROJECT_PATH_SLUG}-scheduled
image: $IMAGE_TAG
imagePullPolicy: IfNotPresent
command:
- "php"
args:
- "artisan"
- "schedule:run"
envFrom:
- configMapRef:
name: ${CI_PROJECT_PATH_SLUG}-config-map
volumeMounts:
- name: storage
mountPath: /app/srcs/storage
imagePullSecrets:
- name: docker-registry-credentials
volumes:
- name: storage
persistentVolumeClaim:
claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
restartPolicy: OnFailure

12385
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,24 +10,27 @@
"production": "mix --production"
},
"devDependencies": {
"animate.css": "^4.1.1",
"axios": "^1.6.5",
"axios": "^0.21",
"bootstrap": "^5.1.3",
"clean-webpack-plugin": "^3.0.0",
"jquery": "^3.6",
"laravel-mix": "^6.0.6",
"laravel-mix-polyfill": "^3.0.1",
"lodash": "^4.17.19",
"mini-css-extract-plugin": "^1.6.2",
"popper.js": "^1.16.1",
"postcss": "^8.1.14",
"resolve-url-loader": "^5.0.0",
"resolve-url-loader": "^4.0.0",
"sass": "^1.32.11",
"sass-loader": "^12.6.0",
"sass-loader": "^11.0.1",
"ui": "^0.2.4",
"vue": "^3.3.12",
"vue-loader": "^17.4.2",
"vue-select": "^4.0.0-beta.6",
"vue-template-compiler": "^2.7.16"
"vue-loader": "^15.9.8",
"vue-select": "^3.16.0",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.64.4"
},
"dependencies": {
"animate.css": "^4.1.1",
"mini-css-extract-plugin": "^1.6.2",
"vue": "^2.6.14"
}
}

View file

@ -31,9 +31,8 @@
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
export default {
mounted() {
this.pictos = JSON.parse(this.dbpictos);
if (this.pictos.length === 0){
@ -134,7 +133,7 @@ export default defineComponent({
this.updateCount();
}
}
});
}
</script>
<style>

View file

@ -22,9 +22,7 @@
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
export default {
mounted() {
this.range = JSON.parse(this.dbRange);
this.range.label = this.range.name + ' - ' + this.range.type;
@ -80,5 +78,5 @@ export default defineComponent({
}
}
}
});
}
</script>

View file

@ -30,33 +30,6 @@ docReady(function () {
}
};
// PAGE CONTACT
let eltCountry = document.getElementById("country");
if (eltCountry) {
eltCountry.addEventListener("click", function () {
showDromField(this);
});
}
let eltsConsoRecla = document.getElementsByClassName("consoRecla");
if (eltsConsoRecla) {
for (let ii = 0; ii < eltsConsoRecla.length; ii++) {
eltsConsoRecla[ii].addEventListener("click", function () {
showReclaFields();
});
}
}
let eltsOtherRecla = document.getElementsByClassName("otherRecla");
if (eltsOtherRecla) {
for (let ii = 0; ii < eltsOtherRecla.length; ii++) {
eltsOtherRecla[ii].addEventListener("click", function () {
hideReclaFields();
});
}
}
// FIN PAGE CONTACT
document
.getElementById("backtotop")
.addEventListener("click", function () {

20
resources/js/vuejs.js vendored
View file

@ -1,23 +1,13 @@
import Vue, { createApp } from "vue";
import ProductsPictos from "./components/backend/ProductsPictos.vue";
window.Vue = require('vue').default;
const setupApp = (app) => {
app.config.globalProperties.window = window;
app.config.globalProperties.document = document;
};
Vue.component('products-pictos', require('./components/backend/ProductsPictos.vue').default);
Vue.component('ranges-sub-ranges', require('./components/backend/RangesSubRanges.vue').default);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
for (let el of document.getElementsByClassName("products-pictos")) {
const app = createApp(ProductsPictos);
setupApp(app);
app.mount(el);
}
for (let el of document.getElementsByClassName("ranges-sub-ranges")) {
const app = createApp(RangesSubRanges);
setupApp(app);
app.mount(el);
for (let el of document.getElementsByClassName('vueComponent')) {
new Vue({ el: el });
}

View file

@ -65,12 +65,24 @@
"Doux, La référence française de la volaille": "",
"Sélectionnez un pays": "",
"Sélectionnez un département": "",
"Guadeloupe": "",
"Martinique": "",
"Guyane": "",
"La Réunion": "",
"Mayotte": "",
"Saint-Pierre-et-Miquelon": "",
"Saint-Barthélémy": "",
"Saint-Martin": "",
"Polynésie française": "",
"Île de Clipperton": "",
"Wallis-et-Futuna": "",
"Nouvelle-Calédonie": "",
"Terres australes et antarctiques françaises": "",
"Doux Food Services": "",
"Tous les produits Doux": "",
"Les actualités Doux": "",
"Nos conseils ...": "Advice ...",
"Nous Rejoindre": "Join us",
"<span class=\"color-red\">les questions<\/span><br><span class=\"color-blue\">utiles<\/span>": "<span class=\"color-red\">Usefull<\/span><br><span class=\"color-blue\">questions<\/span>",
"Nos nouveautés": "",
"Nous travaillons toujours pour améliorer nos recettes et proposer des produits de meilleure qualité": ""
}
}

View file

@ -65,12 +65,24 @@
"Doux, La référence française de la volaille": "Doux, La referencia francesa de la carne de ave",
"Sélectionnez un pays": "Seleccione un país",
"Sélectionnez un département": "Seleccione una provincia",
"Guadeloupe": "Guadalupe",
"Martinique": "Martinica",
"Guyane": "Guayana",
"La Réunion": "Reunión",
"Mayotte": "Mayotte",
"Saint-Pierre-et-Miquelon": "San Pedro y Miquelón",
"Saint-Barthélémy": "San Bartolomé",
"Saint-Martin": "San Martín",
"Polynésie française": "Polinesia francesa",
"Île de Clipperton": "Isla Clipperton",
"Wallis-et-Futuna": "Wallis y Futuna",
"Nouvelle-Calédonie": "Nueva Caledonia",
"Terres australes et antarctiques françaises": "Territorios australes y antárticos franceses",
"Doux Food Services": "Doux Food Services",
"Tous les produits Doux": "Todos los productos Doux",
"Les actualités Doux": "Las últimas noticias de Doux",
"Nos conseils ...": "Nuestros consejos…",
"Nous Rejoindre": "Únete a nosotros",
"<span class=\"color-red\">les questions<\/span><br><span class=\"color-blue\">utiles<\/span>": "<span class=\"color-red\">Preguntas<\/span><br><span class=\"color-blue\">útiles<\/span>",
"Nos nouveautés": "nuestras novedades",
"Nous travaillons toujours pour améliorer nos recettes et proposer des produits de meilleure qualité": "Seguimos trabajando para mejorar nuestras recetas y proponer productos de mejor calidad"
}
}

View file

@ -65,12 +65,24 @@
"Doux, La référence française de la volaille": "Doux, La référence française de la volaille",
"Sélectionnez un pays": "",
"Sélectionnez un département": "",
"Guadeloupe": "",
"Martinique": "",
"Guyane": "",
"La Réunion": "",
"Mayotte": "",
"Saint-Pierre-et-Miquelon": "",
"Saint-Barthélémy": "",
"Saint-Martin": "",
"Polynésie française": "",
"Île de Clipperton": "",
"Wallis-et-Futuna": "",
"Nouvelle-Calédonie": "",
"Terres australes et antarctiques françaises": "",
"Doux Food Services": "",
"Tous les produits Doux": "",
"Les actualités Doux": "",
"Nos conseils ...": "Nos conseils ...",
"Nous Rejoindre": "",
"<span class=\"color-red\">les questions<\/span><br><span class=\"color-blue\">utiles<\/span>": "<span class=\"color-red\">les questions<\/span><br><span class=\"color-blue\">utiles<\/span>",
"Nos nouveautés": "Produits à la une",
"Nous travaillons toujours pour améliorer nos recettes et proposer des produits de meilleure qualité": "Ne ratez aucune de nos nouveautés"
}
}

View file

@ -2,4 +2,4 @@
@import "layouts/backend/top_nav";
@import "vue-select/dist/vue-select.css";
@import "vue-select/src/scss/vue-select.scss";

View file

@ -154,14 +154,7 @@
</tr>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">Expediteur : {{ $data['civilite'] }} {{ $data['name'] }} {{ $data['lastname'] }}<br>
<br> Adresse : {{ $data['address'] }} {{ $data['postcode'] }} {{ $data['city'] }} <br>
<br> Téléphone : {{ $data['phone'] }}<br><br> Email : {{ $data['email'] }}<br>
<br> Pays : {{ $data['country'] }}<br><br> Département : {{ $data['departement'] }}<br><br> Sujet : {{ $data['topic'] }}<br>
@if ($data['topic'] === 'Réclamation')
<br> Produit : {{ $data['product_name'] }}<br><br> Code Barre : {{ $data['barcode'] }}<br><br> Lot : {{ $data['lot'] }}<br><br> Date limite de consommation : {{ $data['limit_date'] }}<br><br> Lieu d'achat : {{ $data['shop'] }}<br><br> Date de consommation : {{ $data['consumption_date'] }}<br>
@endif
<br> Message : <br><br>
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">Expediteur : {{ $data['civilite'] }} {{ $data['name'] }} {{ $data['lastname'] }}<br><br> Adresse : {{ $data['address'] }} {{ $data['postcode'] }} {{ $data['city'] }} <br><br> Téléphone : {{ $data['phone'] }}<br><br> Email : {{ $data['email'] }}<br><br> Pays : {{ $data['country'] }}<br><br> Département : {{ $data['departement'] }}<br><br> Sujet : {{ $data['topic'] }}<br><br> Produit : {{ $data['product_name'] }}<br><br> Code Barre : {{ $data['barcode'] }}<br><br> Lot : {{ $data['lot'] }}<br><br> Date limite de consommation : {{ $data['limit_date'] }}<br><br> Lieu d'achat : {{ $data['shop'] }}<br><br> Date de consommation : {{ $data['consumption_date'] }}<br><br> Message : <br><br>
{{ $data['message'] }}
</div>
</td>

View file

@ -48,14 +48,14 @@
<div class="header-title sectiontitle align-center p-rel">
<h2 class="punchline-module__title align-center animate__animated fadeInUp animate__slow">{!! __('Une question ? Une idée ? Un conseil ?<br>Des informations sur nos produits ?') !!}</h2>
</div>
<p class="align-center">{!! __('N\'hésitez-pas à nous contacter en renseignant le formulaire ci-dessous.<br>Nous traiterons votre demande avec la plus grande attention dans les meilleurs délais.') !!}</p>
<p class="align-center">{!! __('N’hésitez-pas à nous contacter en renseignant le formulaire ci-dessous.<br>Nous traiterons votre demande avec la plus grande attention dans les meilleurs délais.') !!}</p>
@if(session()->has('status'))
<div class="form-result form-result_confirm">
<div class="form-result__title title title_small">{{ __('Votre message a bien été envoyé !') }}</div>
<div class="form-result__text">{{ __('Nos services mettent tout en oeuvre pour y répondre au plus vite.') }}</div>
</div>
@endif
<form id="contact-form" action="{{route($routeprefixer . 'contact.submit')}}" method="post" class="form contact__form" enctype="multipart/form-data">
<form action="{{route($routeprefixer . 'contact.submit')}}" method="post" class="form contact__form" enctype="multipart/form-data">
@csrf
@if ($errors->any())
@foreach ($errors->all() as $error)
@ -110,19 +110,29 @@
</div>
<div class="form-row">
<div class="country">
<select id="country" class="changeLength" maxlength="255" name="country" required>
<select id="country" class="changeLength" maxlength="255" name="country" required onclick="javascript:showDromField(this);">
<option value="" @if(!old('country')) selected @endif>{{ __('Sélectionnez un pays') }} *</option>
@foreach($listCountries as $country)
<option value="{{ $country->value }}" @if(old('country') == $country->value) selected @endif>{{ __($country->label) }}</option>
@foreach($availableCountries as $country)
<option value="{{ $country->label }}" @if(old('country') == $country->label) selected @endif>{{ __($country->label) }}</option>
@endforeach
</select>
</div>
<div class="drom">
<select id="departement" class="changeLength" maxlength="255" name="departement">
<option value="" @if(!old('departement')) selected @endif>{{ __('Sélectionnez un département') }} *</option>
@foreach ($listDeps as $departement)
<option value="{{ $departement->value }}" @if(old('departement') === $departement->value) selected @endif>{{ __($departement->label) }}</option>
@endforeach
<option value="Guadeloupe" @if(old('departement') === 'Guadeloupe') selected @endif>{{ __('Guadeloupe') }}</option>
<option value="Martinique" @if(old('departement') === 'Martinique') selected @endif>{{ __('Martinique') }}</option>
<option value="Guyane" @if(old('departement') === 'Guyane') selected @endif>{{ __('Guyane') }}</option>
<option value="La Réunion" @if(old('departement') === 'La Réunion') selected @endif>{{ __('La Réunion') }}</option>
<option value="Mayotte" @if(old('departement') === 'Mayotte') selected @endif>{{ __('Mayotte') }}</option>
<option value="Saint-Pierre-et-Miquelon" @if(old('departement') === 'Saint-Pierre-et-Miquelon') selected @endif>{{ __('Saint-Pierre-et-Miquelon') }}</option>
<option value="Saint-Barthélémy" @if(old('departement') === 'Saint-Barthélémy') selected @endif>{{ __('Saint-Barthélémy') }}</option>
<option value="Saint-Martin" @if(old('departement') === 'Saint-Martin') selected @endif>{{ __('Saint-Martin') }}</option>
<option value="Polynésie française" @if(old('departement') === 'Polynésie française') selected @endif>{{ __('Polynésie française') }}</option>
<option value="Île de Clipperton" @if(old('departement') === 'Île de Clipperton') selected @endif>{{ __('Île de Clipperton') }}</option>
<option value="Wallis-et-Futuna" @if(old('departement') === 'Wallis-et-Futuna') selected @endif>{{ __('Wallis-et-Futuna') }}</option>
<option value="Nouvelle-Calédonie" @if(old('departement') === 'Nouvelle-Calédonie') selected @endif>{{ __('Nouvelle-Calédonie') }}</option>
<option value="Terres australes et antarctiques françaises" @if(old('departement') === 'Terres australes et antarctiques françaises') selected @endif>{{ __('Terres australes et antarctiques françaises') }}</option>
</select>
</div>
</div>
@ -131,16 +141,16 @@
<legend>{{ __('Préciser votre demande') }} :</legend>
<div class="ck-button">
<label>
<input class="consoRecla" type="radio" value="Réclamation" name="topic" @if (old('topic')=="Réclamation") checked @endif><span>{{ __('Réclamation produit') }}</span>
<input type="radio" value="Réclamation" name="topic" onclick="javascript:showReclaFields();" @if (old('topic')=="Réclamation") checked @endif><span>{{ __('Réclamation produit') }}</span>
</label>
<label>
<input class="otherRecla" type="radio" value="La marque" name="topic" @if (old('topic')=="La marque") checked @endif><span>{{ __('La marque') }}</span>
<input type="radio" value="La marque" name="topic" onclick="javascript:hideReclaFields();" @if (old('topic')=="La marque") checked @endif><span>{{ __('La marque') }}</span>
</label>
<label>
<input class="otherRecla" type="radio" value="Contact Commercial" name="topic" @if (old('topic')=="Contact Commercial") checked @endif><span>{{ __('Contact commercial') }}</span>
<input type="radio" value="Contact Commercial" onclick="javascript:hideReclaFields();" name="topic" @if (old('topic')=="Contact Commercial") checked @endif><span>{{ __('Contact commercial') }}</span>
</label>
<label>
<input class="otherRecla" type="radio" value="Autre" name="topic" @if (old('topic')=="Autre") checked @endif><span>{{ __('Autre demande') }}</span>
<input type="radio" value="Autre" name="topic" onclick="javascript:hideReclaFields();" @if (old('topic')=="Autre") checked @endif><span>{{ __('Autre demande') }}</span>
</label>
</div>
<div class="form-row recla_field">
@ -188,7 +198,6 @@
<label for="rgpd">{{ __('rgpd.contact.acceptcgu') }}</label>
</div>
<div class="align-center">
<div class="g-recaptcha" data-sitekey="{{ config('services.google.recaptcha.public') }}"></div>
<input type="submit" value="Envoyer">
</div>
</form>
@ -198,61 +207,53 @@
@endsection
@push('scripts')
<script nonce="{{ $nonce }}">
function showReclaFields() {
var collection = document.getElementsByClassName('recla_field');
for(let elem of collection) {
elem.style.display = 'flex';
}
document.getElementById('lblFile').innerHTML = 'Photo de l\'emballage*';
document.getElementById('file').required = true;
<script>
function showReclaFields() {
console.log('show');
var collection = document.getElementsByClassName('recla_field');
for(let elem of collection) {
elem.style.display = 'flex';
}
document.getElementById('lblFile').innerHTML = 'Photo de l\'emballage*';
document.getElementById('file').required = true;
}
function hideReclaFields() {
var collection = document.getElementsByClassName('recla_field');
for(let elem of collection) {
elem.style.display = 'none';
}
document.getElementById('lblFile').innerHTML = 'Insérer une pièce jointe';
document.getElementById('file').required = false;
function hideReclaFields() {
console.log('hide');
var collection = document.getElementsByClassName('recla_field');
for(let elem of collection) {
elem.style.display = 'none';
}
document.getElementById('lblFile').innerHTML = 'Insérer une pièce jointe';
document.getElementById('file').required = false;
}
function showDromField() {
const countryList = document.getElementById('country');
const departmentList = document.getElementById('departement');
if (countryList.value=='{{ \App\Enums\Country::france()->value }}') {
departmentList.style.display = 'initial';
departmentList.required = true;
} else {
departmentList.style.display = 'none';
departmentList.required = false;
}
function showDromField(sel) {
if (document.getElementById('country').options[sel.selectedIndex].text=='France') {
var dromList = document.getElementById('departement');
dromList.style.display = 'initial';
dromList.required = true;
} else {
hideDromField();
}
}
document.addEventListener('DOMContentLoaded', function () {
hideReclaFields();
function hideDromField() {
var dromList = document.getElementById('departement');
dromList.style.display = 'none';
dromList.required = false;
}
document.addEventListener('DOMContentLoaded', function () {
hideReclaFields();
hideDromField();
@if (old('topic')=="Réclamation")
showReclaFields();
@endif
@if (old('country')=="France")
showDromField();
@if (old('topic')=="Réclamation")
showReclaFields();
@endif
document.getElementById('country').addEventListener('change', showDromField)
});
@endif
});
</script>
<script nonce="{{ $nonce }}">
window.__LDC_CN_Recaptcha = function() {
(function(d, t) {
let g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'https://www.google.com/recaptcha/api.js';
s.parentNode.insertBefore(g, s)
}(document, 'script'));
};
function onSubmit(token) {
document.getElementById("contact-form").submit();
}
</script>
@endpush

View file

@ -17,9 +17,9 @@
</div>
<!-- Scripts -->
<script src="{{ mix('js/preload-front.js') }}" type="text/javascript" nonce="{{ $nonce }}"></script>
<script src="{{ mix('js/preload-front.js') }}" type="text/javascript"></script>
@stack('scripts')
</body>
</html>
</html>

View file

@ -53,12 +53,11 @@
</div>
</div>
<div class="container footer-content align-center @if (strpos(Route::current()->getName(), 'food') !== false) blue-bg @endif">
<div class="container footer-content align-center @if (Route::current()->getName() == 'food') blue-bg @endif">
<ul>
<li><a href="{{ route($routeprefixer . 'cgu') }}">{{ __('Mentions légales') }}</a></li>
<li><a href="{{ route($routeprefixer . 'policy') }}">{{ __('Charte de confidentialité') }}</a></li>
{{--<li><a href="{{ route($routeprefixer . 'site-map') }}">{{ __('Plan du site') }}</a></li>--}}
<li><a href="https://recrutement.ldc.fr/fr/annonces?brands=593" target="_blank">{{ __('Nous Rejoindre') }}</a></li>
<li><a href="{{ route($routeprefixer . 'contact') }}">{{ __('Contact') }}</a></li>
<li><a href="#cookies" class="ldcweb-cn-cookie-link">{{ __('Gestion des cookies') }}</a></li>
</ul>

View file

@ -124,11 +124,11 @@
</div>
</header>
@push('scripts')
<script nonce="{{ $nonce }}">
<script>
var loupe = document.querySelector("div#search");
loupe.addEventListener("click", function() {
document.querySelector("div.search-form").classList.toggle('is-visible');
});
</script>
@endpush
@endpush

View file

@ -86,7 +86,7 @@
</div>
@push('scripts')
<script nonce="{{ $nonce }}">
<script>
window.LDCWebCN = new LdcwebCn({
'analytics': {
'name': "{!! __('rgpd.analytics.title') !!}",
@ -112,19 +112,7 @@
gtag('js', new Date());
gtag('config', '{{ config('google.analyticsKey') }}');
}
},
'recaptcha': {
'name': "API - reCAPTACHA",
'description': 'Les cookies qui sont déposés via le recaptcha sur les formulaires ont pour finalité d\'empêcher que ceux-ci ne soient soumis par des robots.',
'link': 'https://policies.google.com/privacy',
'labelLink': 'En savoir plus',
'cookies': ['NID', '__Secure-3PAPISID', '__Secure-3PSID', '__Secure-3PSIDCC'],
'script': function() {
if (window.__LDC_CN_Recaptcha) {
window.__LDC_CN_Recaptcha();
}
}
},
}
});
</script>
@endpush

0
storage/app/public/.gitignore vendored Executable file → Normal file
View file