Fix: Try a fix to allow trigger for changing password

This commit is contained in:
Laurent Destailleur 2011-11-02 18:05:01 +01:00
parent 98ce8210ee
commit 2c4618d2f6
2 changed files with 6 additions and 2 deletions

View File

@ -1221,7 +1221,9 @@ class User extends CommonObject
// Mise a jour
if (! $changelater)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
$sql.= " pass_temp = null";
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
@ -1239,7 +1241,7 @@ class User extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->affected_rows($result))
if ($this->db->affected_rows($result))
{
$this->pass=$password;
$this->pass_indatabase=$password;

View File

@ -362,6 +362,8 @@ if ($action == 'update' && ! $_POST["cancel"])
$edituser = new User($db);
$edituser->fetch($_GET["id"]);
$edituser->oldcopy=dol_clone($edituser);
$ret=$edituser->setPassword($user,$_POST["password"]);
if ($ret < 0)
{