From 4dcae09efe8a718c3fedf7e66b827aeee4d33a7a Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH] Task #0001793: Installation mot de passe for password , use NOALYSS_ADMIN_PASSWORD --- html/install.php | 16 ++++++++++------ include/lib/config_file.php | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/html/install.php b/html/install.php index a83e7e1b2..ca76438a3 100644 --- a/html/install.php +++ b/html/install.php @@ -272,6 +272,7 @@ if (isset($_POST['save_config'])) { // //------------------------------------------------------------------------ if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) { + echo '

'._('Entrez les informations nécessaires à noalyss').'

'; echo '
'; require_once NOALYSS_INCLUDE.'/lib/config_file.php'; @@ -524,7 +525,7 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; - $cn->exec_sql("update ac_users set use_login=$1,use_password=md5($2),use_active=1 where use_id=1", + $cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1", array(strtolower($cadmin),$icpassword_admin)); $cn->commit($cn); @@ -619,11 +620,11 @@ if (defined("MULTI") && MULTI == 0) } } - $db->exec_sql("update ac_users set use_login=$1 where use_id=1", - array(strtolower(NOALYSS_ADMINISTRATOR))); + $db->exec_sql("update ac_users set use_login=$1,use_pass=2 where use_id=1", + array(strtolower(NOALYSS_ADMINISTRATOR),NOALYSS_ADMIN_PASSWORD)); echo '

'._('Important').'

'; echo '

'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'

'; - echo '

',_('Mot de passe par défaut à l\'installation'),' phpcompta','

'; + echo "

"; printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__); echo "

"; @@ -642,9 +643,12 @@ define ('ALLOWED',1); define ('ALLOWED_ADMIN',1); $rep=new Database(); -if (defined(NOALYSS_ADMINISTRATOR)) +if (defined(NOALYSS_ADMINISTRATOR) && defined (NOALYSS_ADMIN_PASSWORD)) { - $rep->exec_sql("update ac_users set use_login=$1 where use_id=1", array(strtolower(NOALYSS_ADMINISTRATOR))); + $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5(2) + where use_id=1", + array(strtolower(NOALYSS_ADMINISTRATOR), + NOALYSS_ADMIN_PASSWORD)); } Dossier::upgrade(); echo '

'._('Important').'

'; diff --git a/include/lib/config_file.php b/include/lib/config_file.php index f9c89ee45..3f9f7228f 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -161,9 +161,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ("// For changing the password of admin, go to preference or update in db"); print ("\r\n"); - print ("// this password is only used when installing "); + print ("// this password is only used when executing install.php "); print ("\r\n"); - print ( 'define ("NOALYSS_PASSWORD","'.$icpassword_admin.'");'); + print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$icpassword_admin.'");'); print ("\r\n"); print ( 'define ("LOCALE",'.$clocale.');');