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

first install.
This commit is contained in:
Laurent Destailleur 2015-11-22 11:32:31 +01:00
parent c7447b0899
commit e438d76df9
4 changed files with 22 additions and 6 deletions

View File

@ -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'),

View File

@ -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);

View File

@ -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);

View File

@ -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;