Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

postfixadmin_changepass.php 4.7KB

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