le mdp des comptes mails étaient changés dans certains cas où il ne fallait pas

This commit is contained in:
quenenni 2017-09-12 14:49:33 +02:00
parent 65f994f763
commit f6f5a15ded
2 changed files with 16 additions and 4 deletions

View File

@ -57,9 +57,19 @@ if (!$res=$mail->get_details($mail_id)) {
exit();
} else {
$canbeempty = ($islocal != 1 || ($islocal == 1 && !$new_account))?true:false;
if (!$mail->set_passwd($mail_id,$pass,$canbeempty)) { /* SET THE PASSWORD */
include ("mail_edit.php");
exit();
if ($new_account || !empty($pass) || $islocal != 1) {
if ($islocal != 1)
$pass = "";
if (!$mail->set_passwd($mail_id,$pass,$canbeempty)) { /* SET THE PASSWORD */
include ("mail_edit.php");
exit();
}
} else if (!$new_account && empty($pass) && $islocal == 1 && $res['password'] == "") {
if (!$mail->set_passwd($mail_id,$pass, false)) { /* SET THE PASSWORD */
include ("mail_edit.php");
exit();
}
}
}

View File

@ -615,7 +615,9 @@ ORDER BY
if (!$admin->checkPolicy("pop", $email, $pass, $canbeempty)) {
return false;
}
if (!$db->query("UPDATE address SET password= ? where id = ? ;", array(_md5cr($pass), $mail_id ))) {
if ($canbeempty && empty($pass)) {
return $db->query("UPDATE address SET password= ? where id = ? ;", array(null, $mail_id ));
} else if (!$db->query("UPDATE address SET password= ? where id = ? ;", array(_md5cr($pass), $mail_id ))) {
return false;
}
return true;