Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0

This commit is contained in:
ldestailleur 2025-08-25 21:51:28 +02:00
commit f710eaa2a4

View file

@ -133,6 +133,15 @@ if (empty($reshook)) {
$result = $edituser->fetch('', '', '', 1, $conf->entity, $username);
}
// If the user does not have the right to change his own password
if ($result > 0) {
$edituser->getrights('user');
if (!$edituser->hasRight('user', 'self', 'password')) {
$result = 0;
$edituser->error = 'USERNOTALLOWEDTOCHANGEPASS';
}
}
// Set the message to show (must be the same if login/email exists or not
// to avoid to guess them.
$messagewarning = '<div class="warning paddingtopbottom'.(!getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? '' : ' backgroundsemitransparent boxshadow').'">';
@ -143,7 +152,7 @@ if (empty($reshook)) {
}
$messagewarning .= '</div>';
if ($result <= 0 && $edituser->error == 'USERNOTFOUND') {
if ($result <= 0 && ($edituser->error == 'USERNOTFOUND' || $edituser->error == 'USERNOTALLOWEDTOCHANGEPASS')) {
usleep(20000); // add delay to simulate setPassword() and send_password() actions delay (0.02s)
$message .= $messagewarning;
$username = '';