Skip to content
Snippets Groups Projects
Commit e438d76d authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW Option encrypt password into databae is set to on by default on

first install.
parent c7447b08
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ include_once 'inc.php';
$err = 0;
$allowinstall = 0;
$allowupgrade = 0;
$allowupgrade = false;
$checksok = 1;
$setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):$langs->getDefaultLang();
......@@ -181,11 +181,11 @@ if (is_readable($conffile) && filesize($conffile) > 8)
if ($databaseok)
{
// Already installed for all parts (config and database). We can propose upgrade.
$allowupgrade=1;
$allowupgrade=true;
}
else
{
$allowupgrade=0;
$allowupgrade=false;
}
}
else
......@@ -216,7 +216,7 @@ else
}
// First install, we can't upgrade
$allowupgrade=0;
$allowupgrade=false;
}
......@@ -382,6 +382,7 @@ else
$allowupgrade=false;
}
if (defined("MAIN_NOT_INSTALLED")) $allowupgrade=false;
if (GETPOST('allowupgrade')) $allowupgrade=true;
$migrationscript=array( array('from'=>'3.0.0', 'to'=>'3.1.0'),
array('from'=>'3.1.0', 'to'=>'3.2.0'),
array('from'=>'3.2.0', 'to'=>'3.3.0'),
......
......@@ -21,6 +21,8 @@
ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_fk_pcg_version (fk_pcg_version);
ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_account_number (account_number);
ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
--ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_account_number FOREIGN KEY (fk_account_number) REFERENCES llx_accounting_account (account_number);
--ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_account_number FOREIGN KEY (fk_account_number) REFERENCES llx_accounting_account (account_number);
-- This keys are created into foreign table after creation of foreign index
--ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
......@@ -20,3 +20,5 @@
ALTER TABLE llx_accounting_system ADD UNIQUE INDEX uk_accounting_system_pcg_version (pcg_version);
-- This key is for another table but created here because must be done after foreign key index is created
ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
......@@ -167,6 +167,17 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
// Create user
include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php';
// Set default encryption to yes if there is no user yet into database
$sql = "SELECT u.rowid, u.pass, u.pass_crypted";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
//$sql.= " WHERE u.pass IS NOT NULL AND LENGTH(u.pass) < 32"; // Not a MD5 value
$resql=$db->query($sql);
if ($resql)
{
$numrows=$db->num_rows($resql);
if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity);
}
$createuser=new User($db);
$createuser->id=0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment