Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

postfixadmin_changepass.php 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. require_once(dirname(__FILE__) . '/common.php');
  3. $xmlrpc = get_xmlrpc();
  4. $user = $xmlrpc->getProxy('user');
  5. global $username;
  6. do_header();
  7. $USERID_USERNAME = $username;
  8. $tmp = preg_split ('/@/', $USERID_USERNAME);
  9. $USERID_DOMAIN = $tmp[1];
  10. $stMessage = '';
  11. $tMessage = '';
  12. $pPassword_admin_text = '';
  13. $pPassword_password_current_text = '';
  14. $pPassword_password_text = '';
  15. $error = 0;
  16. if ($_SERVER['REQUEST_METHOD'] == "POST")
  17. {
  18. //$pPassword_password_text = _("pPassword_password_text");
  19. $fPassword_current = $_POST['fPassword_current'];
  20. $fPassword = $_POST['fPassword'];
  21. $fPassword2 = $_POST['fPassword2'];
  22. $username = $USERID_USERNAME;
  23. if(!$user->login($_SESSION['username'], $_POST['fPassword_current'])) {
  24. $error = 1;
  25. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  26. textdomain('postfixadmin');
  27. $pPassword_password_current_text = _("You didn't supply your current password!");
  28. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  29. textdomain('squirrelmail');
  30. }
  31. $min_length = 0;
  32. if(isset($CONF['min_password_length'])) {
  33. $min_length = $CONF['min_password_length'];
  34. }
  35. if (empty ($fPassword) or ($fPassword != $fPassword2) or ($min_length > 0 && strlen($fPassword) < $min_length)) {
  36. $error = 1;
  37. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  38. textdomain('postfixadmin');
  39. if(empty($fPassword)) {
  40. $pPassword_password_text .= _("The passwords that you supplied are empty!");
  41. }
  42. if($fPassword != $fPassword2) {
  43. $pPassword_password_text .= _("The passwords that you supplied don't match!");
  44. }
  45. if($min_length > 0 && strlen($fPassword) < $min_length) {
  46. $pPassword_password_text .= _("The password you supplied is too short!");
  47. }
  48. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  49. textdomain('squirrelmail');
  50. }
  51. if ($error != 1) {
  52. $success = $user->changePassword($fPassword_current, $fPassword);
  53. if ($success) {
  54. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  55. textdomain('postfixadmin');
  56. $tMessage = _("Your password has been changed!");
  57. $stMessage = _("Please sign out and log back again with your new password!");
  58. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  59. textdomain('squirrelmail');
  60. }
  61. else {
  62. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  63. textdomain('postfixadmin');
  64. $tMessage = _("Unable to change your password!");
  65. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  66. textdomain('squirrelmail');
  67. }
  68. }
  69. }
  70. bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
  71. textdomain('postfixadmin');
  72. echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
  73. <tr>
  74. <td align=\"center\"><b>". _("Options") ." - ". _("Change Password")." </b>
  75. <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
  76. <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
  77. <table align=\"center\" width=\"95%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
  78. <td bgcolor=\"$color[3]\" align=\"center\"><b>" ._("Change your login password") ."\n
  79. </b></td>
  80. </tr>
  81. <tr>
  82. <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"mailbox\" method=\"post\">
  83. <b>$tMessage<b><font color=red><br>
  84. <a href=\"../../src/signout.php\" target=\"_top\">$stMessage</a>
  85. ".$pPassword_admin_text."\n
  86. ".$pPassword_password_current_text."\n
  87. ".$pPassword_password_text."\n
  88. </b><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
  89. <tr>
  90. <td width=\"37%\"><b>". _("Alias") . ":\n</td>
  91. <td width=\"63%\">{$_SESSION['username']}</td>
  92. </tr>
  93. <tr>
  94. <td><b>". _("Password current"). ":\n</td>
  95. <td><input type=\"password\" name=\"fPassword_current\" size=\"30\" /></td>
  96. </tr>
  97. <tr>
  98. <td><b>". _("Password new"). ":\n</td>
  99. <td><input type=\"password\" name=\"fPassword\" size=\"30\" /></td>
  100. </tr>
  101. <tr>
  102. <td><b>". _("Password new again"). ":\n</td>
  103. <td><input type=\"password\" name=\"fPassword2\" size=\"30\" /></td>
  104. </tr>
  105. <tr>
  106. <td>&nbsp;</td>
  107. <td><input type=\"submit\" name=\"submit\" value=\"" ._("Change Password") . "\" /></td>
  108. <td>&nbsp;</td>
  109. </tr>
  110. </table>
  111. <TT></TT></FORM></td>
  112. </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
  113. </tr></table><BR>
  114. </td>
  115. </tr></table></td></tr></table>";
  116. bindtextdomain('squirrelmail', SM_PATH . 'locale');
  117. textdomain('squirrelmail');
  118. ?>