diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 93ca97dc41d..d2b6ea8f26e 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -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 = '