Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

update-password.html 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {% block title %} Reset Password {% endblock %}
  2. {% block content %}
  3. <div class="container">
  4. <div class="row" style="margin-top: 40px; margin-bottom: 20px">
  5. <div class="col-sm-offset-3 col-sm-6">
  6. <div class="panel panel-default">
  7. <div class="panel-heading">
  8. <h4><i class="icon-key"></i> Reset Password</h4>
  9. </div>
  10. <div class="panel-body">
  11. <div class="form-group">
  12. <input id="old_password" type="password"
  13. class="form-control" placeholder="Old Password">
  14. </div>
  15. <div class="form-group">
  16. <input id="new_password" type="password"
  17. class="form-control" placeholder="New Password">
  18. </div>
  19. <div class="form-group">
  20. <button type="submit" id="update"
  21. class="btn btn-primary">Update</button>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. <script>
  29. $(document).ready(function() {
  30. if(get_url_arg("key")) {
  31. $("#old_password").parent().toggle(false);
  32. }
  33. $("#new_password").on("keypress", function(e) {
  34. if(e.which===13) $("#update").click();
  35. })
  36. $("#update").click(function() {
  37. var args = {
  38. key: get_url_arg("key") || "",
  39. old_password: $("#old_password").val(),
  40. new_password: $("#new_password").val()
  41. }
  42. if(!args.old_password && !args.key) {
  43. wn.msgprint("Old Password Required.");
  44. return;
  45. }
  46. if(!args.new_password) {
  47. wn.msgprint("New Password Required.")
  48. return;
  49. }
  50. wn.call({
  51. type: "POST",
  52. method: "webnotes.core.doctype.profile.profile.update_password",
  53. btn: $("#update"),
  54. args: args,
  55. callback: function(r) {
  56. if(r.message) {
  57. $("input").val("");
  58. var dialog = wn.msgprint(r.message);
  59. dialog.on("hide.bs.modal", function() {
  60. window.location.href = "login";
  61. });
  62. }
  63. }
  64. })
  65. })
  66. });
  67. </script>
  68. {% endblock %}