--- phpgwapi/inc/class.auth_mail.inc.php-orig 2007-09-19 19:53:31.000000000 -0300
+++ phpgwapi/inc/class.auth_mail.inc.php 2007-04-20 13:13:11.000000000 -0300
@@ -87,6 +87,40 @@
function change_password($old_passwd, $new_passwd)
{
- return False;
+
+ include('/var/alternc/bureau/class/functions.php');
+ $db_host=$GLOBALS['mail_change_pwd']['db_host'];
+ $db_port=$GLOBALS['mail_change_pwd']['db_port'];
+ $db_pwd_user=$GLOBALS['mail_change_pwd']['db_user'];
+ $db_pwd_name=$GLOBALS['mail_change_pwd']['db_name'];
+ $db_pwd_pass=$GLOBALS['mail_change_pwd']['db_pass'];
+
+ $table=$GLOBALS['mail_change_pwd']['table_users'];
+
+ $username =$GLOBALS['egw_info']['user']['account_lid'];
+ $username_=str_replace("@","_",$GLOBALS['egw_info']['user']['account_lid']);
+ $crypted_passwd=_md5cr($new_passwd);
+
+ $connect_sql=mysql_connect($db_host.":".$db_port,$db_pwd_user,$db_pwd_pass);
+ if ($connect_sql)
+ {
+ $db=mysql_select_db($db_pwd_name,$connect_sql);
+ if($db)
+ {
+ $query="UPDATE $table SET password=\"$crypted_passwd\"
+ WHERE alias in (\"$username\",\"$username_\")";
+
+ //print "
".$query;
+
+ $result=mysql_query($query, $connect_sql);
+
+ if ($result)
+ {return true;}else return false;
+ }else
+ {return false;}
+
+ }else
+ {return false;}
+
}
}