selfservice.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. include_once ('tools/htpasswd.php');
  3. include_once ('includes/head.php');
  4. include_once ('includes/nav.php');
  5. $htpasswd = new htpasswd ( $ini ['secure_path'] . ".htpasswd" );
  6. ?>
  7. <div class="container box">
  8. <div class="row">
  9. <div class="col-xs-12">
  10. <h2>Change your password here:</h2>
  11. <?php
  12. $equal = true;
  13. $success = false;
  14. if (isset ( $_POST ['user'] ) && isset ( $_POST ['oldpwd'] ) && isset ( $_POST ['newpwd'] ) && isset ( $_POST ['newpwd2'] )) {
  15. $username = $_POST ['user'];
  16. $old = $_POST ['oldpwd'];
  17. $new = $_POST ['newpwd'];
  18. $new2 = $_POST ['newpwd2'];
  19. if ($new == $new2 && $htpasswd->user_check ( $username, $old )) {
  20. $htpasswd->user_update ( $username, $new );
  21. ?>
  22. <div class="alert alert-info">Password changed successfully.</div>
  23. <?php
  24. } else {
  25. ?>
  26. <div class="alert alert-danger">Could not change password.</div>
  27. <?php
  28. }
  29. }
  30. ?>
  31. <div class="result alert alert-info" style="display: none;"></div>
  32. </div>
  33. </div>
  34. <div class=row>
  35. <div class="col-xs-12 col-md-4">
  36. <form class="navbar-form navbar-left" action="selfservice.php"
  37. method="post">
  38. <div class="form-group">
  39. <input type="text" class="userfield form-control"
  40. placeholder="Username" name="user" <?php if (isset($_GET['user'])) echo "value=".htmlspecialchars($_GET['user']);?>>
  41. </p>
  42. <p>
  43. <input class="passwordfield form-control" type="password"
  44. name="oldpwd" placeholder="Old Password" <?php if (isset($_GET['user'])) echo "autofocus" ?>/>
  45. </p>
  46. <p>
  47. <input class="passwordfield form-control" type="password"
  48. name="newpwd" placeholder="New Password" />
  49. </p>
  50. <p>
  51. <input class="passwordfield form-control" type="password"
  52. name="newpwd2" placeholder="Repeat new Password" />
  53. </p>
  54. <button type="submit" class="btn btn-default">Change</button>
  55. </div>
  56. </form>
  57. </div>
  58. </div>
  59. <div class=row>
  60. <br/><br/>
  61. <div class="col-xs-12 col-md-10 well">
  62. <p>Note: You can't change the admin password here. This is only for user passwords.</p>
  63. </div>
  64. </div>
  65. </div>
  66. <?php
  67. include_once ('includes/footer.php');
  68. ?>