From c4b44d135a1941c633d784a72f8123745cecff27 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH] =?UTF-8?q?Task=20#0001793:=20Installation=20mot=20de=20pa?= =?UTF-8?q?sse=20Emp=C3=AAche=20@mobile=20,=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/install.php | 55 +++++++++++++++++------ include/lib/config_file.php | 10 +++-- include/template/template_config_form.php | 3 +- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/html/install.php b/html/install.php index 699ef28e7..513c8b982 100644 --- a/html/install.php +++ b/html/install.php @@ -161,6 +161,8 @@ content[205]=""; content[206]=""; content[207]=""; content[208]=""; +content[209]=""; +content[210]=""; @@ -181,7 +183,7 @@ if ( strpos($inc_path,";") != 0 ) { $new_path=$inc_path.':../../include:addon'; $os=1; /* $os is 1 for unix */ } -// Retrieve informations from the very screen +// Retrieve informations from the screen // $http=new HttpInput(); $db_user=$http->request("cuser","string", ""); @@ -194,7 +196,7 @@ $ctmp=$http->request("ctmp","string", "/tmp"); $cpath=$http->request("cpath","string", "/usr/bin"); $db_name=$http->request("cdbname", "string",""); $cadmin=$http->request("cadmin","string", "admin"); -$icpassword_admin=$http->request("icpassword_admin","string", "phpcompta"); +$cpassword_admin=$http->request("cpassword_admin","string", "phpcompta"); $cadmin=strtolower($cadmin); //------------------------------------------------------------------------- // warn only if we can not write in include @@ -214,6 +216,36 @@ if ( is_writable ('install.php') == false ) { if (isset($_POST['save_config'])) { require_once NOALYSS_INCLUDE.'/lib/config_file.php'; + $err=0; + // check password and admin not empty + // + if ( strlen(trim($cpassword_admin))== 0 || + strlen(trim($cadmin))== 0 + ) { + echo '

'; + echo _('Le mot de passe du super admin et le login ne peuvent être vides'); + echo '

'; + $err++; + + } + + // check password and admin not containing quote or double quote + // + if ( strpos($cpassword_admin,'"') !== false + || strpos($cadmin,'"') !== false + || strpos($cpassword_admin,"'") !== false + || strpos($cadmin,"'") !== false + || strpos($cpassword_admin," ") !== false + || strpos($cadmin," ") !== false + || strpos($cadmin,"@mobile") !== false + ) { + echo '

'; + echo _('Le mot de passe du super admin et le superadmin ne peut pas contenir des guillemets ou espaces, ni @mobile'); + echo '

'; + $err++; + + } + // Try to connect , if it doesn't work that do not create the config file if ($multi=="N") { $cnx = new DatabaseCore($db_user, $db_password,'template1', $db_host, $db_port); @@ -223,14 +255,14 @@ if (isset($_POST['save_config'])) { // ----- // If conx successfull save the file or display it // ----- - if ( $cnx !== false ) { + if ( $err == 0 && $cnx !== false ) { echo '

'._('Important').'

'; echo '

',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , " . " il a tous les droits et a accès à tout." . " Connectez-vous avec ses identifiants et changer le mot de passe dans préférence (en haut à droit)"), "

"; echo '

'._('Utilisateur administrateur'),' ',' ',$cadmin,'','

'; - echo '

',_('Mot de passe'),' '.$icpassword_admin.' ','

'; + echo '

',_('Mot de passe'),' '.$cpassword_admin.' ','

'; // Create the db if (is_writable(NOALYSS_INCLUDE)) { $url=config_file_create($_POST,1,$os); @@ -258,18 +290,13 @@ if (isset($_POST['save_config'])) { echo ''; return; } - } else { + } elseif ($err == 0 && $cnx == false) { echo '

'; echo _('Impossible de se connecter à Postgresql, vérifiez les informations de connection'); echo '

'; } } -if ( strlen(trim($icpassword_admin))== 0 ) { - echo '

'; - echo _('Le mot de passe du super admin ne peut être vide'); - echo '

'; -} //------------------------------------------------------------------------ // Check that the file config.inc.php exists , if not then propose to @@ -374,7 +401,7 @@ for ($m=0;$m<$nb_need_module;$m++) if ( ini_get("max_execution_time") < 60 ) { echo "
  • "; echo _('Avertissement').' : '.$failed; - echo ' ', + echo ' ', _("max_execution_time devrait être de 60 minimum"), ''; echo "
  • "; @@ -531,9 +558,9 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; - $icpassword_admin=NOALYSS_ADMIN_PASSWORD; + $cpassword_admin=NOALYSS_ADMIN_PASSWORD; $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)); + array(strtolower($cadmin),$cpassword_admin)); $cn->commit($cn); @@ -652,7 +679,7 @@ define ('ALLOWED_ADMIN',1); $rep=new Database(); if (defined("NOALYSS_ADMINISTRATOR") && defined ("NOALYSS_ADMIN_PASSWORD")) { - $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5(2) + $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)); diff --git a/include/lib/config_file.php b/include/lib/config_file.php index c6e93ee73..42587f287 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -106,7 +106,8 @@ function config_file_form($p_array=null) $icdbname=new IText('cdbname'); $icdbname->value=$cdbname; - $icpassword_admin=new IText('icpassword_admin'); + $icpassword_admin=new IText('cpassword_admin'); + $icpassword_admin->value=$cpassword_admin; require NOALYSS_TEMPLATE.'/template_config_form.php'; } @@ -153,8 +154,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ( 'define ("noalyss_psql_host","'.$chost.'");'); print ("\r\n"); print ("\r\n"); - print ("// If you change the NOALYSS_ADMINISTRATOR or NOALYSS_ADMIN_PASSWORD, " - . "you will need to rerun http://..../noalyss/html/install.php"); + print ("// If you change the NOALYSS_ADMINISTRATOR , you will need to rerun http://..../noalyss/html/install.php"); + print ("\r\n"); + print ("// But it doesn't change the password"); print ("\r\n"); print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");'); print ("\r\n"); @@ -162,7 +164,7 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ("// this password is only used when executing install.php "); print ("\r\n"); - print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$icpassword_admin.'");'); + print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$cpassword_admin.'");'); print ("\r\n"); print ( 'define ("LOCALE",'.$clocale.');'); diff --git a/include/template/template_config_form.php b/include/template/template_config_form.php index 39f2f1975..455e9ff7f 100644 --- a/include/template/template_config_form.php +++ b/include/template/template_config_form.php @@ -57,7 +57,7 @@ - input();?> + input();echo Icon_Action::infobulle(210)?> @@ -66,6 +66,7 @@ input();?> +