From 75ed221fb8911b185084cf056eb3c0a44c5b8bab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2016 23:58:04 +0100 Subject: [PATCH] Fix regression with last PR: change of password was not working. --- htdocs/user/card.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 58d87a68c8c..835b127c6a4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -476,21 +476,25 @@ if (empty($reshook)) { $db->rollback(); } } - } else { - if ($caneditpassword) // Case we can edit only password - { - $object->fetch($id); - - $object->oldcopy = clone $object; - - $ret = $object->setPassword($user, $_POST["password"]); - if ($ret < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } } } + else + { + if ($caneditpassword) // Case we can edit only password + { + dol_syslog("Not allowed to change fields, only password"); + + $object->fetch($id); + + $object->oldcopy = clone $object; + + $ret = $object->setPassword($user, GETPOST("password")); + if ($ret < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } } // Change password with a new generated one