resetPasswordTemplate.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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>{{host_name}} - Reset 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>Reset your account password on {{host_name}}</p>
  24. </div>
  25. <div class="ui divider"></div>
  26. <form class="ui form" onsubmit="handleFormSubmit(event, this);">
  27. <div class="disabled field">
  28. <label>Username</label>
  29. <input type="text" name="username" value="{{username}}" readonly=true>
  30. </div>
  31. <div class="disabled field">
  32. <label>Password Reset Key</label>
  33. <input type="text" name="rkey" value="{{rkey}}" readonly=true>
  34. </div>
  35. <div class="ui divider"></div>
  36. <div class="field">
  37. <label>New Password</label>
  38. <input id="npw" type="password" name="newpw" placeholder="New Password">
  39. </div>
  40. <div class="field">
  41. <label>Confirm New Password</label>
  42. <input id="cpw" type="password" name="confirmnewpw" placeholder="Confirm New Password">
  43. </div>
  44. <button id="submitbtn" class="ui green button" type="submit">Reset</button>
  45. </form>
  46. <div id="errmsg" class="ui red inverted segment" style="display:none;">
  47. <i class="remove icon"></i> <span id="errtext">Internal Server Error</span>
  48. </div>
  49. <br>
  50. <p>Back to <a href="../index.html">Login</a></p>
  51. </div>
  52. </div>
  53. <script>
  54. var username = "{{username}}";
  55. var resetPasswordKey = "{{rkey}}";
  56. function handleFormSubmit(evt,obj){
  57. evt.preventDefault();
  58. var newpw = obj.newpw.value;
  59. var cpw = obj.confirmnewpw.value;
  60. $("#npw").parent().removeClass("error");
  61. $("#cpw").parent().removeClass("error");
  62. if (newpw != cpw){
  63. showErrorMessage("Confirm password does not match.")
  64. $("#cpw").parent().addClass("error");
  65. return
  66. }
  67. if (newpw == "" || cpw == ""){
  68. showErrorMessage("Password cannot be empty")
  69. $("#npw").parent().addClass("error");
  70. }
  71. //Should be OK now. Submit the form for reset password
  72. $.ajax({
  73. url: "system/reset/confirmPasswordReset",
  74. method: "POST",
  75. data: {username: username, rkey: resetPasswordKey, pw: newpw},
  76. success: function(data){
  77. if (data.error !== undefined){
  78. showErrorMessage(data.error);
  79. }else{
  80. //OK
  81. window.location.href = "index.html";
  82. }
  83. }
  84. })
  85. }
  86. function showErrorMessage(msg){
  87. $("#errtext").text(msg);
  88. $("#errmsg").stop().finish().slideDown("fast");
  89. }
  90. </script>
  91. </body>
  92. </html>