Ajout trigger USER_NEW_PASSWORD (modification mot de passe)

This commit is contained in:
Laurent Destailleur 2006-04-24 21:28:24 +00:00
parent c50b6c2b41
commit ffc0f88f2a
3 changed files with 21 additions and 9 deletions

View File

@ -110,6 +110,10 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
} }
elseif ($action == 'USER_NEW_PASSWORD')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
}
elseif ($action == 'USER_DISABLE') elseif ($action == 'USER_DISABLE')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);

View File

@ -865,7 +865,6 @@ class User
{ {
$sqlpass = $password; $sqlpass = $password;
} }
$this->pass=$password;
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET pass = '".addslashes($sqlpass)."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."user SET pass = '".addslashes($sqlpass)."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
@ -874,6 +873,15 @@ class User
{ {
if ($this->db->affected_rows()) if ($this->db->affected_rows())
{ {
$this->pass=$password;
// 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) $error++;
// Fin appel triggers
return $this->pass; return $this->pass;
} }
else { else {

View File

@ -212,7 +212,7 @@ if ($_POST["action"] == 'update' && $caneditperms)
} }
if ($ret >= 0 && isset($_POST["password"]) && $_POST["password"] !='' ) if ($ret >= 0 && isset($_POST["password"]) && $_POST["password"] !='' )
{ {
$ret=$edituser->password($user,$password,$conf->password_encrypted); $ret=$edituser->password($user,$password,$conf->password_encrypted,1);
if ($ret < 0) if ($ret < 0)
{ {
$message.='<div class="error">'.$edituser->error.'</div>'; $message.='<div class="error">'.$edituser->error.'</div>';