Fix do not change password if same

This commit is contained in:
Laurent Destailleur 2023-01-16 10:57:31 +01:00
parent 70bec95307
commit acc30da1fe
4 changed files with 6 additions and 5 deletions

View File

@ -931,7 +931,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid = 0;
} else {
// TODO Merge all previous cases into this generic one
// $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ...
// $action = PASSWORD, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ...
// Can also be a value defined by an external module like SENTBYSMS, COMPANY_SENTBYSMS, MEMBER_SENTBYSMS, ...
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function).
// Note that these key can be set in agenda setup, only if defined into llx_c_action_trigger

View File

@ -66,7 +66,8 @@ LinkedToDolibarrUser=Link to user
LinkedToDolibarrThirdParty=Link to third party
CreateDolibarrLogin=Create a user
CreateDolibarrThirdParty=Create a third party
LoginAccountDisableInDolibarr=Account disabled in Dolibarr.
LoginAccountDisableInDolibarr=Account disabled in Dolibarr
PASSWORDInDolibarr=Password modified in Dolibarr
UsePersonalValue=Use personal value
ExportDataset_user_1=Users and their properties
DomainUser=Domain user %s

View File

@ -521,7 +521,7 @@ if (empty($reshook)) {
}
if (!$error) {
$ret = $object->update($user);
$ret = $object->update($user); // This may include call to setPassword if password has changed
if ($ret < 0) {
$error++;
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {

View File

@ -2031,9 +2031,9 @@ class User extends CommonObject
// Update password
if (!empty($this->pass)) {
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
if ($this->pass != $this->pass_indatabase && !dol_verifyHash($this->pass, $this->pass_indatabase_crypted)) {
// If a new value for password is set and different than the one crypted into database
$result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass);
$result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass, 0, 1);
if ($result < 0) {
return -5;
}