selfservice.php 2.1 KB

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