newPasswordTemplate.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <title>New Password</title>
  7. <link rel="stylesheet" href="../../../script/semantic/semantic.css">
  8. <link rel="stylesheet" href="../../../script/ao.css">
  9. <script type="application/javascript" src="../../../script/jquery.min.js"></script>
  10. <script type="application/javascript" src="../../../script/semantic/semantic.js"></script>
  11. <style>
  12. </style>
  13. </head>
  14. <body>
  15. <br><br><br>
  16. <div class="ui container" align="center">
  17. <div class="ui basic segment" style="max-width:400px;" align="left">
  18. <div class="imageRight" align="center">
  19. <img class="ui small image" src="data:image/png;base64, {{vendor_logo}}"></img>
  20. </div>
  21. <div class="ui divider"></div>
  22. <div class="ui text container">
  23. <p>Hi {{display_name}}, Please set your local password.</p>
  24. </div>
  25. <div class="ui divider"></div>
  26. <form class="ui form" onsubmit="handleFormSubmit(event, this);">
  27. <div class="ui divider"></div>
  28. <div class="field">
  29. <label>New Password</label>
  30. <input id="npw" type="password" name="newpw" placeholder="New Password">
  31. </div>
  32. <div class="field">
  33. <label>Confirm New Password</label>
  34. <input id="cpw" type="password" name="confirmnewpw" placeholder="Confirm New Password">
  35. </div>
  36. <button id="submitbtn" class="ui green button" type="submit">Submit</button>
  37. </form>
  38. <div id="errmsg" class="ui red inverted segment" style="display:none;">
  39. <i class="remove icon"></i> <span id="errtext">Internal Server Error</span>
  40. </div>
  41. <br>
  42. <p>Back to <a href="../../../ldapLogin.system">Login</a></p>
  43. </div>
  44. </div>
  45. <script>
  46. var username = "{{username}}";
  47. var key = "{{key}}";
  48. function handleFormSubmit(evt, obj) {
  49. evt.preventDefault();
  50. var newpw = obj.newpw.value;
  51. var cpw = obj.confirmnewpw.value;
  52. $("#npw").parent().removeClass("error");
  53. $("#cpw").parent().removeClass("error");
  54. if (newpw != cpw) {
  55. showErrorMessage("Confirm password does not match.")
  56. $("#cpw").parent().addClass("error");
  57. return
  58. }
  59. if (newpw == "" || cpw == "") {
  60. showErrorMessage("Password cannot be empty")
  61. $("#npw").parent().addClass("error");
  62. }
  63. //Should be OK now. Submit the form for reset password
  64. $.ajax({
  65. url: "../../../system/auth/ldap/setPassword",
  66. method: "POST",
  67. data: {
  68. username: username,
  69. password: newpw,
  70. authkey: key,
  71. },
  72. success: function(data) {
  73. if (data.error !== undefined) {
  74. showErrorMessage(data.error);
  75. } else {
  76. //OK
  77. window.location.href = "../../../";
  78. }
  79. }
  80. })
  81. }
  82. function showErrorMessage(msg) {
  83. $("#errtext").text(msg);
  84. $("#errmsg").stop().finish().slideDown("fast");
  85. }
  86. </script>
  87. </body>
  88. </html>