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

Fix: Creation user depuis fiche adherent oubliait le mot de passe

parent b7417233
No related branches found
No related tags found
No related merge requests found
......@@ -802,13 +802,14 @@ class User
*/
function create_from_member($member)
{
global $langs;
global $user,$langs;
// Positionne paramtres
$this->nom = $member->nom;
$this->prenom = $member->prenom;
$this->login = $member->login;
$this->pass = $member->pass;
$this->admin = 0;
$this->email = $member->email;
......@@ -817,10 +818,11 @@ class User
// Cre et positionne $this->id
$result=$this->create();
if ($result > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$result=$this->password($user,$this->pass,0,0,1);
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET fk_member=".$member->id;
$sql.= " WHERE rowid=".$this->id;
$resql=$this->db->query($sql);
......@@ -829,7 +831,7 @@ class User
{
$this->db->commit();
return $this->id;
}
}
else
{
$this->error=$this->db->error()." - ".$sql;
......@@ -998,9 +1000,10 @@ class User
* \param password Nouveau mot de passe ( gnrer si non communiqu)
* \param noclearpassword 0 ou 1 s'il ne faut pas stocker le mot de passe en clair
* \param changelater 1=Change password only after clicking on confirm email
* \param notrigger 1=Ne declenche pas les triggers
* \return string Mot de passe non crypt, < 0 si erreur
*/
function password($user, $password='', $noclearpassword=0, $changelater=0)
function password($user, $password='', $noclearpassword=0, $changelater=0, $notrigger=0)
{
global $langs;
......@@ -1042,13 +1045,16 @@ class User
$this->pass_indatabase=$password;
$this->pass_indatabase_crypted=$password_crypted;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('USER_NEW_PASSWORD',$this,$user,$lang,$conf);
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
if (! $notrigger)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('USER_NEW_PASSWORD',$this,$user,$lang,$conf);
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
}
return $this->pass;
}
else {
......
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