Afegir SameSite=None per la cookie de sessió
També s'afegeix que la cookie de sessió sigui segura en producció.
Change-Id: Ib162c3666b4055de67aa81db83680e174482219e
diff --git a/core.php b/core.php
index e58a7eb..ae96f1c 100644
--- a/core.php
+++ b/core.php
@@ -14,9 +14,16 @@
$con = new PDO('mysql:host='.$conf['db']['host'].';dbname='.$conf['db']['database'].';charset=utf8mb4', $conf['db']['user'], $conf['db']['password']);
// Session settings
-session_set_cookie_params([
- 'lifetime' => 0,
- 'path' => ($conf['path'] ?? '/'),
- 'httponly' => true
-]);
+if(PHP_VERSION_ID < 70300) {
+ session_set_cookie_params(0, ($conf['path'] ?? '/').'; samesite=None', $_SERVER['HTTP_HOST'], $conf['isProduction'], true);
+} else {
+ session_set_cookie_params([
+ 'lifetime' => 0,
+ 'path' => ($conf['path'] ?? '/'),
+ 'secure' => ($conf['isProduction']),
+ 'httponly' => true,
+ 'samesite' => 'None'
+ ]);
+}
+
session_start();