FIX Pb in install when password start with some special char like !

This commit is contained in:
Laurent Destailleur 2023-04-15 04:29:19 +02:00
parent 443f5190db
commit 747cd766b0
4 changed files with 9 additions and 9 deletions

View File

@ -1166,7 +1166,7 @@ class Adherent extends CommonObject
if ($result >= 0) {
$result = $luser->setPassword($user, $this->pass, 0, 0, 1);
if ($result < 0) {
if (is_numeric($result) && $result < 0) {
$this->error = $luser->error;
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
$error++;

View File

@ -2045,7 +2045,7 @@ class User extends CommonObject
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, 0, 1);
if ($result < 0) {
if (is_numeric($result) && $result < 0) {
return -5;
}
}

View File

@ -142,16 +142,16 @@ if (empty($reshook)) {
$messagewarning .= '</div>';
if ($result <= 0 && $edituser->error == 'USERNOTFOUND') {
usleep(20000); // add delay to simulate setPassword and send_password actions delay
usleep(20000); // add delay to simulate setPassword and send_password actions delay (0.02s)
$message .= $messagewarning;
$username = '';
} else {
if (empty($edituser->email)) {
usleep(20000); // add delay to simulate setPassword and send_password actions delay
usleep(20000); // add delay to simulate setPassword and send_password actions delay (0.02s)
$message .= $messagewarning;
} else {
$newpassword = $edituser->setPassword($user, '', 1);
if ($newpassword < 0) {
if (is_numeric($newpassword) && $newpassword < 0) {
// Technical failure
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
} else {

View File

@ -691,13 +691,13 @@ function setUserPassword($authentication, $shortuser)
$res = $userstat->fetch('', $shortuser['login']);
if ($res) {
$res = $userstat->setPassword($userstat, $shortuser['password']);
if ($res) {
if (is_numeric($res) && $res < 0) {
$error++;
$errorcode = 'NOT_MODIFIED'; $errorlabel = 'Error when changing password';
} else {
$objectresp = array(
'result'=>array('result_code' => 'OK', 'result_label' => ''),
);
} else {
$error++;
$errorcode = 'NOT_MODIFIED'; $errorlabel = 'Error when changing password';
}
} else {
$error++;