passwd.tmpl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {{template "header.tmpl" .}}
  2. </head>
  3. <body>
  4. {{template "navbar.tmpl" .}}
  5. <div class="container-fluid">
  6. <h4 class="text-center">修改密码</h4>
  7. <hr />
  8. <div class="row">
  9. <div class="col-md-4 col-md-offset-4">
  10. <div class="pannel">
  11. <div class="pannel_body">
  12. <form id="mainform">
  13. <div class="form-group">
  14. <label>ID</label>
  15. <input type="text" class="form-control" name="" value="{{.Sess.Account.Id}}" maxlength="20" readonly="readonly" />
  16. </div>
  17. <div class="form-group">
  18. <label>用户名</label>
  19. <input type="text" class="form-control" name="" value="{{.Sess.Account.Account}}" maxlength="20" readonly="readonly" />
  20. </div>
  21. <div class="form-group">
  22. <label>旧密码</label>
  23. <input type="password" class="form-control" name="oldpwd" value="" maxlength="20" />
  24. </div>
  25. <div class="form-group">
  26. <label>新密码(6位以上)</label>
  27. <input type="password" class="form-control" name="newpwd" value="" maxlength="20" />
  28. </div>
  29. <div class="form-group">
  30. <label>重复新密码</label>
  31. <input type="password" class="form-control" name="newpwd2" value="" maxlength="20" />
  32. </div>
  33. <button class="btn btn-primary">提交</button>
  34. </form>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <script type="text/javascript">
  41. var $SESS = {{.Sess}};
  42. $(function(){
  43. $('#mainform').submit(function(){
  44. if (this.oldpwd.value == '') {
  45. $.alert({'content': '旧密码不能为空!'});
  46. } else if (this.oldpwd.value.length < 6) {
  47. $.alert({'content': '旧密码格式不正确!'});
  48. } else if (this.newpwd.value == '') {
  49. $.alert({'content': '新密码不能为空!'});
  50. } else if (this.newpwd.value.length < 6) {
  51. $.alert({'content': '新密码格式不正确!'});
  52. } else if (this.newpwd2.value != this.newpwd.value) {
  53. $.alert({'content': '新密码两次输入不一致!'});
  54. } else {
  55. $.post('/profile/passwd', $(this).serialize(), function(resp){
  56. if (resp.errno) {
  57. $.alert({'content': resp.error});
  58. } else {
  59. $.alert({'content': '修改成功!'});
  60. }
  61. }, 'json');
  62. }
  63. return false;
  64. });
  65. });
  66. </script>
  67. </body>
  68. </html>