login.tmpl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="stylesheet" href="/resources/bootstrap-3.4.1-dist/css/bootstrap.min.css" />
  7. <title>RedisDog - 登录</title>
  8. <style type="text/css">
  9. body{
  10. padding: 0px 10px;
  11. font-size: 14px;
  12. }
  13. h1{
  14. margin: 30px;
  15. text-align: center;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div class="container" style="width:400px;">
  21. <h1>RedisDog</h1>
  22. <form action="/login" method="POST" id="loginform">
  23. <div class="form-group">
  24. <label for=""><strong>用户名</strong></label>
  25. <input type="text" class="form-control" name="account" maxlength="20" value="" />
  26. </div>
  27. <div class="form-group">
  28. <label for=""><strong>密码</strong></label>
  29. <input type="password" class="form-control" name="passwd" maxlength="20" value="" />
  30. </div>
  31. <button type="submit" class="btn btn-primary">提交</button>
  32. <button type="button" class="btn btn-default">忘记密码</button>
  33. </form>
  34. </div>
  35. <script type="text/javascript" src="/resources/js/jquery-3.4.1.min.js"></script>
  36. <script type="text/javascript" src="/resources/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
  37. <script type="text/javascript" src="/resources/js/common.js"></script>
  38. <script type="text/javascript">
  39. $(function(){
  40. $('#loginform').submit(function(){
  41. if (this.account.value == '') {
  42. $.alert('请填写要登录的账号!');
  43. } else if (/\W/.test(this.account.value)) {
  44. $.alert('账号格式不正确!');
  45. } else if (this.passwd.value == '') {
  46. $.alert('请填写账号密码!');
  47. } else {
  48. $.post(this.action, $(this).serialize(), function(resp){
  49. if (resp.errno) {
  50. $.alert(resp.error);
  51. } else {
  52. document.location = 'index';
  53. }
  54. }, 'json');
  55. }
  56. return false;
  57. });
  58. });
  59. </script>
  60. </body>
  61. </html>