Fix: A l'install le mot de passe du compte admin est sauvegardé de manière incomplète.
This commit is contained in:
parent
ab57443a44
commit
6d6a8270cb
@ -99,24 +99,30 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
|||||||
{
|
{
|
||||||
$conf->setValues($db);
|
$conf->setValues($db);
|
||||||
|
|
||||||
$sql = "INSERT INTO llx_user(datec,login,pass,admin,name) VALUES (now()";
|
// Create user
|
||||||
$sql.= ",'".$_POST["login"]."'";
|
include_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||||
$sql.= ",'".($conf->password_encrypted?md5($_POST["pass"]):$_POST["pass"])."'";
|
|
||||||
$sql.= ",1,'Administrateur')";
|
|
||||||
//print "sql=".$sql." ".mysql_errno($db->db);
|
|
||||||
|
|
||||||
dolibarr_install_syslog('install/etape5.php sql='.$sql, LOG_INFO);
|
$createuser=new User($db);
|
||||||
$resql=$db->query($sql);
|
$createuser->id=0;
|
||||||
if ($resql)
|
|
||||||
|
$newuser = new User($db);
|
||||||
|
$newuser->nom='Admin';
|
||||||
|
$newuser->prenom='';
|
||||||
|
$newuser->login=$_POST["login"];
|
||||||
|
$newuser->pass=$_POST["pass"];
|
||||||
|
$newuser->admin=1;
|
||||||
|
|
||||||
|
$result=$newuser->create($createuser,1);
|
||||||
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print $langs->trans("AdminLoginCreatedSuccessfuly",$_POST["login"])."<br>";
|
print $langs->trans("AdminLoginCreatedSuccessfuly",$_POST["login"])."<br>";
|
||||||
$success = 1;
|
$success = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($newuser->error == 'ErrorLoginAlreadyExists')
|
||||||
{
|
{
|
||||||
dolibarr_install_syslog('install/etape5.php DB_ERROR_RECORD_ALREADY_EXISTS', LOG_WARNING);
|
dolibarr_install_syslog('install/etape5.php ErrorLoginAlreadyExists', LOG_WARNING);
|
||||||
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists",$_POST["login"])."</div><br>";
|
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists",$_POST["login"])."</div><br>";
|
||||||
$success = 1;
|
$success = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,3 +13,4 @@ ErrorBadSupplierCodeSyntax=Bad syntax for supplier code
|
|||||||
ErrorSupplierCodeRequired=Supplier code required
|
ErrorSupplierCodeRequired=Supplier code required
|
||||||
ErrorSupplierCodeAlreadyUsed=Supplier code already used
|
ErrorSupplierCodeAlreadyUsed=Supplier code already used
|
||||||
ErrorBadParameters=Bad parameters
|
ErrorBadParameters=Bad parameters
|
||||||
|
UserCannotBeDelete=User can not be deleted. May be it is associated on Dolibarr entities.
|
||||||
@ -73,7 +73,7 @@ SetupEnd=End of setup
|
|||||||
SystemIsInstalled=Your system is now installed.
|
SystemIsInstalled=Your system is now installed.
|
||||||
SystemIsUpgraded=Dolibarr has been upgraded successfully.
|
SystemIsUpgraded=Dolibarr has been upgraded successfully.
|
||||||
YouNeedToPersonalizeSetup=Now you must configure Dolibarr to match your needs (Look choice, functionnalities, ...). For this, click on the following link:
|
YouNeedToPersonalizeSetup=Now you must configure Dolibarr to match your needs (Look choice, functionnalities, ...). For this, click on the following link:
|
||||||
AdminLoginCreatedSuccessfuly=Administrator login created successfuly.
|
AdminLoginCreatedSuccessfuly=Dolibarr administrator login '<b>%s</b>' created successfuly.
|
||||||
GoToSetupArea=Go to setup area
|
GoToSetupArea=Go to setup area
|
||||||
Examples=Examples
|
Examples=Examples
|
||||||
WithNoSlashAtTheEnd=Without the slash "/" at the end
|
WithNoSlashAtTheEnd=Without the slash "/" at the end
|
||||||
@ -81,7 +81,7 @@ DirectoryRecommendation=It is recommanded to put this directry out of directory
|
|||||||
LoginAlreadyExists=Already exists
|
LoginAlreadyExists=Already exists
|
||||||
DolibarrAdminLogin=Dolibarr admin login
|
DolibarrAdminLogin=Dolibarr admin login
|
||||||
FailedToCreateAdminLogin=Failed to create Dolibarr administator account.
|
FailedToCreateAdminLogin=Failed to create Dolibarr administator account.
|
||||||
AdminLoginAlreadyExists=Dolibarr administrator account '%s' already exists.
|
AdminLoginAlreadyExists=Dolibarr administrator account '<b>%s</b>' already exists.
|
||||||
WarningRemoveInstallDir=Warning, for security reasons, once install or upgrade is finished, you have to remove the install directory.
|
WarningRemoveInstallDir=Warning, for security reasons, once install or upgrade is finished, you have to remove the install directory.
|
||||||
ThisPHPDoesNotSupportTypeBase=This PHP system does not support interfaces to access database type %s
|
ThisPHPDoesNotSupportTypeBase=This PHP system does not support interfaces to access database type %s
|
||||||
FunctionNotAvailableInThisPHP=Not available on this PHP
|
FunctionNotAvailableInThisPHP=Not available on this PHP
|
||||||
|
|||||||
@ -13,3 +13,4 @@ ErrorBadSupplierCodeSyntax=La syntaxe du code fournisseur est incorrect
|
|||||||
ErrorSupplierCodeRequired=Code fournisseur obligatoire
|
ErrorSupplierCodeRequired=Code fournisseur obligatoire
|
||||||
ErrorSupplierCodeAlreadyUsed=Code fournisseur deja utilise
|
ErrorSupplierCodeAlreadyUsed=Code fournisseur deja utilise
|
||||||
ErrorBadParameters=Parametres incorrects
|
ErrorBadParameters=Parametres incorrects
|
||||||
|
UserCannotBeDelete=L'utilisateur ne peut pas etre supprimée. Peut-être est-il associé à des éléments de Dolibarr.
|
||||||
@ -75,7 +75,7 @@ SetupEnd=Fin de l'installation
|
|||||||
SystemIsInstalled=Votre système est maintenant installé.
|
SystemIsInstalled=Votre système est maintenant installé.
|
||||||
SystemIsUpgraded=Dolibarr a été mis à jour avec succès.
|
SystemIsUpgraded=Dolibarr a été mis à jour avec succès.
|
||||||
YouNeedToPersonalizeSetup=Vous devez maintenant configurer Dolibarr selon vos besoins (Choix de l'apparence, des fonctionnalités, etc.). Pour cela, cliquez sur le lien ci-dessous:
|
YouNeedToPersonalizeSetup=Vous devez maintenant configurer Dolibarr selon vos besoins (Choix de l'apparence, des fonctionnalités, etc.). Pour cela, cliquez sur le lien ci-dessous:
|
||||||
AdminLoginCreatedSuccessfuly=Création du compte administrateur réussie.
|
AdminLoginCreatedSuccessfuly=Création du compte administrateur Dolibarr '<b>%s</b>' réussie.
|
||||||
GoToSetupArea=Accès à l'espace de configuration
|
GoToSetupArea=Accès à l'espace de configuration
|
||||||
Examples=Exemples
|
Examples=Exemples
|
||||||
WithNoSlashAtTheEnd=Sans le slash "/" à la fin
|
WithNoSlashAtTheEnd=Sans le slash "/" à la fin
|
||||||
@ -83,7 +83,7 @@ DirectoryRecommendation=Il est recommand
|
|||||||
LoginAlreadyExists=Existe déjà
|
LoginAlreadyExists=Existe déjà
|
||||||
DolibarrAdminLogin=Login de l'utilisateur administrateur de Dolibarr
|
DolibarrAdminLogin=Login de l'utilisateur administrateur de Dolibarr
|
||||||
FailedToCreateAdminLogin=Echec de la création du compte administrateur Dolibarr.
|
FailedToCreateAdminLogin=Echec de la création du compte administrateur Dolibarr.
|
||||||
AdminLoginAlreadyExists=Compte administrateur Dolibarr '%s' déjà existant.
|
AdminLoginAlreadyExists=Compte administrateur Dolibarr '<b>%s</b>' déjà existant.
|
||||||
WarningRemoveInstallDir=Attention, pour des raisons de sécurité, une fois l'installation terminée, il est nécessaire de supprimer le répertoire install.
|
WarningRemoveInstallDir=Attention, pour des raisons de sécurité, une fois l'installation terminée, il est nécessaire de supprimer le répertoire install.
|
||||||
ThisPHPDoesNotSupportTypeBase=Le système PHP ne supporta pas les interfaces d'accès pour les bases %s
|
ThisPHPDoesNotSupportTypeBase=Le système PHP ne supporta pas les interfaces d'accès pour les bases %s
|
||||||
FunctionNotAvailableInThisPHP=Non disponible sur ce PHP
|
FunctionNotAvailableInThisPHP=Non disponible sur ce PHP
|
||||||
|
|||||||
@ -682,13 +682,14 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function create($user='',$notrigger=0)
|
function create($user='',$notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf;
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
$this->login = trim($this->login);
|
$this->login = trim($this->login);
|
||||||
|
|
||||||
dolibarr_syslog("User::Create login=".$this->login.", user=".$user->id);
|
dolibarr_syslog("User::Create login=".$this->login.", user=".(is_object($user)?$user->id:''));
|
||||||
|
|
||||||
|
$error=0;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."user";
|
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."user";
|
||||||
@ -701,7 +702,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$this->error = $langs->trans("ErrorLoginAlreadyExists");
|
$this->error = 'ErrorLoginAlreadyExists';
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -731,7 +732,7 @@ class User extends CommonObject
|
|||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->STOCK_USERSTOCK == 1 && $conf->global->STOCK_USERSTOCK_AUTOCREATE == 1)
|
if (! empty($conf->global->STOCK_USERSTOCK) && ! empty($conf->global->STOCK_USERSTOCK_AUTOCREATE))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
|
||||||
$entrepot = new Entrepot($this->db);
|
$entrepot = new Entrepot($this->db);
|
||||||
|
|||||||
@ -114,6 +114,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
|||||||
$result = $edituser->delete();
|
$result = $edituser->delete();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
$message='<div class="error">'.$langs->trans("UserCannotBeDelete").'</div>';
|
$message='<div class="error">'.$langs->trans("UserCannotBeDelete").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user