Gestion des cookies

This commit is contained in:
fredtempez 2022-01-25 11:36:11 +01:00
parent ee91af4bdc
commit 199022a244

View File

@ -212,12 +212,11 @@ core.start = function() {
*/ */
$("#cookieForm").submit(function(event){ $("#cookieForm").submit(function(event){
// Varables des cookies // Variables des cookies
var samesite = "samesite=lax";
var getUrl = window.location; var getUrl = window.location;
var domain = "domain=" + getUrl.host; var domain = "domain=" + getUrl.host + ";";
var path = "path=" + getUrl.pathname.split('/')[1]; var path = "path=" + getUrl.pathname.split('/')[1] + ";";
var samesite = "samesite=lax";
var e = new Date(); var e = new Date();
e.setFullYear(e.getFullYear() + 1); e.setFullYear(e.getFullYear() + 1);
var expires = "expires=" + e.toUTCString(); var expires = "expires=" + e.toUTCString();
@ -229,15 +228,15 @@ core.start = function() {
// Traitement du retour de la checkbox // Traitement du retour de la checkbox
if ($("#googleAnalytics").is(":checked")) { if ($("#googleAnalytics").is(":checked")) {
// L'URL du serveur faut TRUE // L'URL du serveur faut TRUE
document.cookie = "ZWII_COOKIE_GA_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_GA_CONSENT=true;samesite=strict;" + domain + path + expires;
} else { } else {
document.cookie = "ZWII_COOKIE_GA_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires; document.cookie = "ZWII_COOKIE_GA_CONSENT=false;samesite=strict;" + domain + path + expires;
} }
} }
// Stocke le cookie d'acceptation // Stocke le cookie d'acceptation
document.cookie = "ZWII_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires; document.cookie = "ZWII_COOKIE_CONSENT=true;samesite=strict;" + domain + path + expires;
}); });