diff --git a/.gitattributes b/.gitattributes index 69174870..642107a6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -544,12 +544,12 @@ selenium/README -text selenium/alternc.domain-local-mail-tld.html -text squirrelmail/Makefile -text squirrelmail/alternc-changepass/change.php -text -squirrelmail/alternc-changepass/config.php -text squirrelmail/alternc-changepass/setup.php -text squirrelmail/class/m_squirrelmail.php -text squirrelmail/squirrelmail-install -text squirrelmail/templates/apache2/squirrelmail.conf -text squirrelmail/templates/javascript-common/javascript-common.conf -text +squirrelmail/templates/squirrelmail/alternc-changepass.conf -text squirrelmail/templates/squirrelmail/apache.conf -text squirrelmail/templates/squirrelmail/avelsieve-config.php -text src/Makefile -text diff --git a/squirrelmail/alternc-changepass/change.php b/squirrelmail/alternc-changepass/change.php index 95d9fc79..7c7396a9 100644 --- a/squirrelmail/alternc-changepass/change.php +++ b/squirrelmail/alternc-changepass/change.php @@ -1,51 +1,69 @@ query("SELECT password FROM mail_users WHERE alias='".addslashes($username)."'"); - if (!$db->next_record()) { + $r=mysql_query("SELECT a.password FROM address a,domaines d WHERE a.address='".addslashes($login)."' AND a.dom_id=d.id AND d.domaine='".addslashes($domain)."';"); + if (!($c=mysql_fetch_array($r))) { $errstr=_("Your account has not been found, please try again later or ask an administrator."); } else { - if ($db->f("password")!=_md5cr($_POST['acp_oldpass'],$db->f("password"))) { + if ($c["password"]!=_md5cr($_POST['acp_oldpass'],$c["password"])) { $errstr=_("Your current password is incorrect, please try again."); } else { - // If available, check the password policy : + // FIXME DO Check the password policy : + /* if (is_callable(array($admin,"checkPolicy")) && !$admin->checkPolicy("pop",$username,$_POST['acp_newpass'])) { $errstr=_("This password is not strong enough for your policy, set a stronger password or call your administrator"); } else { + */ // ok, let's change the password - $m=explode("@",$username,2); $acp_newpass=$_POST['acp_newpass']; $newp=_md5cr($acp_newpass); - $un1=str_replace("@","_",$username); // version login_domain.tld - $un2=substr($un1,0,strlen($un1)-strlen(strrchr($un1,"_")))."@".substr(strrchr($un1,"_"),1); // version login@domain.tld - $db->query("UPDATE mail_users SET password='$newp' WHERE alias='$un1' or alias='$un2';"); - + mysql_query("UPDATE address SET password='".addslashes($newp)."' WHERE id=".$c["id"]." ;"); $errstr=_("Your password has been successfully changed. Don't forget to change it in your mail software if you are using one (Outlook, Mozilla, Thunderbird, Eudora ...)"); // Write new cookies for the password @@ -53,27 +71,23 @@ if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) { sqsession_register($onetimepad,'onetimepad'); $key = OneTimePadEncrypt($acp_newpass, $onetimepad); setcookie("key", $key, 0, $base_uri); - } + // } } } } - } - +} // POSTED data ? + textdomain("squirrelmail"); displayPageHeader($color, 'None'); - textdomain("changepass"); + textdomain("alternc-changepass"); - } - - if ($errstr) echo "

".$errstr."

"; ?> -

diff --git a/squirrelmail/alternc-changepass/config.php b/squirrelmail/alternc-changepass/config.php deleted file mode 100644 index f1bbd0f4..00000000 --- a/squirrelmail/alternc-changepass/config.php +++ /dev/null @@ -1,45 +0,0 @@ -Host = $L_MYSQL_HOST; - $this->Database = $L_MYSQL_DATABASE; - $this->User = $L_MYSQL_LOGIN; - $this->Password = $L_MYSQL_PWD; - } - } - $db= new DB_system(); -} - - -$err=new m_err(); - -require_once($root."class/m_admin.php"); -$admin=new m_admin(); -$classes[]="admin"; -require_once($root."class/m_mail.php"); -$mail=new m_mail(); -$classes[]="mail"; - - -?> diff --git a/squirrelmail/alternc-changepass/setup.php b/squirrelmail/alternc-changepass/setup.php index 66862ebc..6e6e2395 100644 --- a/squirrelmail/alternc-changepass/setup.php +++ b/squirrelmail/alternc-changepass/setup.php @@ -1,21 +1,21 @@ _("Change Password"), 'url' => '../plugins/alternc_changepass/change.php', - 'desc' => _("This allow you to change your mail password."), + 'desc' => _("Change the password of your email account."), 'js' => false ); textdomain("squirrelmail"); diff --git a/squirrelmail/templates/squirrelmail/alternc-changepass.conf b/squirrelmail/templates/squirrelmail/alternc-changepass.conf new file mode 100644 index 00000000..4b860e39 --- /dev/null +++ b/squirrelmail/templates/squirrelmail/alternc-changepass.conf @@ -0,0 +1,9 @@ + \ No newline at end of file