From 7a41a851c86846f7107d8ae917b780ec7a02cf7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Nov 2022 18:09:54 +0100 Subject: [PATCH] Fix pb with DATABASE_PWD_ENCRYPTED --- htdocs/admin/security.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index a1281351176..8f7dc42a56a 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -58,7 +58,11 @@ if ($action == 'activate_encrypt') { $db->begin(); - dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); + // On old version a bug created the constant into user entity, so we delete it to be sure, such entry won't exists. We want it in entity 0 or nowhere. + dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); + // We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody + $entityforall = 0; + dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall); $sql = "SELECT u.rowid, u.pass, u.pass_crypted"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u";