From 4269d82d639b88ca71e2bc4e6ccc61bf084b2e24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2026 03:10:22 +0100 Subject: [PATCH] Set a value by default for PAYMENT_SECURITY_TOKEN --- htdocs/install/step5.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 9ee233056ba..dd164a068fd 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -274,17 +274,21 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { if ($numrows == 0) { // Define default setup for password encryption dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities if (function_exists('password_hash')) { dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities } else { dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities + dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities } } dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = ' . getDolGlobalString('DATABASE_PWD_ENCRYPTED').' MAIN_SECURITY_HASH_ALGO = ' . getDolGlobalString('MAIN_SECURITY_HASH_ALGO'), LOG_INFO); } + // Set some default variables + dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", bin2hex(random_bytes(12)), 'chaine', 0, '', 0); // All entities + + // Create user used to create the admin user $createuser = new User($db); $createuser->id = 0;