1
0
Fork 0

Generate CSRF token on session start

master
Anonymous Contributor 2023-08-23 18:16:34 +02:00
parent c78e7e2007
commit a446cfd9c1
1 changed files with 4 additions and 0 deletions

View File

@ -10,7 +10,11 @@ session_set_cookie_params([
'secure' => true,
'samesite' => 'Lax'
]);
session_start();
if(!isset($_SESSION['csrf']) || strlen($_SESSION['csrf'] != 64)) {
$_SESSION['csrf'] = bin2hex(random_bytes(32));
}
include_once 'classen/MAIL/PHPMailer.php';
include_once 'classen/MAIL/SMTP.php';