From f6f5a15ded6c49aa7ad3603649af6e1b6ea39a94 Mon Sep 17 00:00:00 2001 From: quenenni Date: Tue, 12 Sep 2017 14:49:33 +0200 Subject: [PATCH] =?UTF-8?q?le=20mdp=20des=20comptes=20mails=20=C3=A9taient?= =?UTF-8?q?=20chang=C3=A9s=20dans=20certains=20cas=20o=C3=B9=20il=20ne=20f?= =?UTF-8?q?allait=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/admin/mail_doedit.php | 16 +++++++++++++--- bureau/class/m_mail.php | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) 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;