| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
if (!$already) { |
|---|
| 4 |
define('SM_PATH','../../'); |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
require_once(SM_PATH . 'include/validate.php'); |
|---|
| 8 |
require_once(SM_PATH . 'functions/page_header.php'); |
|---|
| 9 |
require_once(SM_PATH . 'functions/imap.php'); |
|---|
| 10 |
require_once(SM_PATH . 'include/load_prefs.php'); |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
sqgetGlobalVar('username', $username, SQ_SESSION); |
|---|
| 14 |
|
|---|
| 15 |
require_once (SM_PATH . "plugins/alternc_changepass/config.php"); |
|---|
| 16 |
|
|---|
| 17 |
session_start(); |
|---|
| 18 |
|
|---|
| 19 |
textdomain("changepass"); |
|---|
| 20 |
|
|---|
| 21 |
global $username, $base_uri, $key, $onetimepad; |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) { |
|---|
| 25 |
if ($_POST['acp_newpass']!=$_POST['acp_verify']) { |
|---|
| 26 |
$err=_("Your new passwords are differents, pleasy try again."); |
|---|
| 27 |
} else { |
|---|
| 28 |
|
|---|
| 29 |
$db->query("SELECT password FROM mail_users WHERE alias='".addslashes($username)."'"); |
|---|
| 30 |
if (!$db->next_record()) { |
|---|
| 31 |
$err=_("Your account has not been found, please try again later or ask an administrator."); |
|---|
| 32 |
} else { |
|---|
| 33 |
if ($db->f("password")!=_md5cr($_POST['acp_oldpass'],$db->f("password"))) { |
|---|
| 34 |
$err=_("Your current password is incorrect, please try again."); |
|---|
| 35 |
} else { |
|---|
| 36 |
|
|---|
| 37 |
$newp=_md5cr($_POST['acp_newpass']); |
|---|
| 38 |
$un1=str_replace("@","_",$username); |
|---|
| 39 |
$un2=substr($un1,0,strlen($un1)-strlen(strrchr($un1,"_")))."@".substr(strrchr($un1,"_"),1); |
|---|
| 40 |
$db->query("UPDATE mail_users SET password='$newp' WHERE alias='$un1' or alias='$un2';"); |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
$ku=substr($username,0,strpos($un2,"@")); |
|---|
| 44 |
mysql_query("UPDATE mailfr.users SET password='".addslashes($acp_newpass)."' WHERE username='".addslashes($un2)."';"); |
|---|
| 45 |
mysql_query("UPDATE mailfr_jabber.users SET jabberpassword='".addslashes($acp_newpass)."' WHERE username='".addslashes($ku)."';"); |
|---|
| 46 |
/PATCH MAILFR */ |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
// Write new cookies for the password |
|---|
| 50 |
$onetimepad = OneTimePadCreate(strlen($acp_newpass)); |
|---|
| 51 |
sqsession_register($onetimepad,'onetimepad'); |
|---|
| 52 |
$key = OneTimePadEncrypt($acp_newpass, $onetimepad); |
|---|
| 53 |
setcookie("key", $key, 0, $base_uri); |
|---|
| 54 |
} |
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
textdomain("squirrelmail"); |
|---|
| 61 |
|
|---|
| 62 |
displayPageHeader($color, 'None'); |
|---|
| 63 |
|
|---|
| 64 |
textdomain("changepass"); |
|---|
| 65 |
|
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
echo "<p><b>"; |
|---|
| 70 |
if($err) echo _("Error:")." ".$err; |
|---|
| 71 |
else echo _("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 ...)"); |
|---|
| 72 |
echo "</b></p>"; |
|---|
| 73 |
|
|---|
| 74 |
?> |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
<h1><?php __("Changing your mail password"); ?></h1> |
|---|
| 78 |
<form method="post" action="change.php"> |
|---|
| 79 |
<table> |
|---|
| 80 |
<tr> |
|---|
| 81 |
<th align="right"><label for="acp_oldpass"><?php __("Old Password:"); ?></label></th> |
|---|
| 82 |
<td><input type="password" name="acp_oldpass" id="acp_oldpass" value="" size="20" /></td> |
|---|
| 83 |
</tr> |
|---|
| 84 |
|
|---|
| 85 |
<tr> |
|---|
| 86 |
<th align="right"><label for="acp_newpass"><?php __("New Password:"); ?></label></th> |
|---|
| 87 |
<td><input type="password" name="acp_newpass" id="acp_newpass" value="" size="20" /></td> |
|---|
| 88 |
</tr> |
|---|
| 89 |
<tr> |
|---|
| 90 |
<th align="right"><label for="acp_verify"><?php __("Verify New Password:"); ?></label></th> |
|---|
| 91 |
<td><input type="password" name="acp_verify" id="acp_verify" value="" size="20" /></td> |
|---|
| 92 |
</tr> |
|---|
| 93 |
|
|---|
| 94 |
<tr> |
|---|
| 95 |
<td align="center" colspan="2"><input type="submit" value="<?php __("Change my mail password"); ?>" name="plugin_changepass" /></td> |
|---|
| 96 |
</tr> |
|---|
| 97 |
</table> |
|---|
| 98 |
|
|---|
| 99 |
</form> |
|---|
| 100 |
|
|---|
| 101 |
</body></html> |
|---|
| 102 |
<?php |
|---|
| 103 |
|
|---|
| 104 |
textdomain("squirrelmail"); |
|---|
| 105 |
|
|---|
| 106 |
?> |
|---|
| 107 |
|
|---|