diff --git a/bureau/admin/mail_doedit.php b/bureau/admin/mail_doedit.php index 29138356..46561e0a 100644 --- a/bureau/admin/mail_doedit.php +++ b/bureau/admin/mail_doedit.php @@ -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(); + } } } diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php index 667241b9..b5bfe530 100644 --- a/bureau/class/m_mail.php +++ b/bureau/class/m_mail.php @@ -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;