Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0
This commit is contained in:
commit
f710eaa2a4
1 changed files with 10 additions and 1 deletions
|
|
@ -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 = '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue