login.html 815 B

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Login</title>
  5. <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  6. </script>
  7. </head>
  8. <body>
  9. <h1>Admin Login</h1>
  10. <p>Please enter your password here</p>
  11. <input id="password" type="password">
  12. <button onclick="handleLogin()">Login</button>
  13. <script>
  14. function handleLogin() {
  15. var password = $("#password").val();
  16. $.ajax({
  17. url: "/login",
  18. data: {password: password},
  19. success: function(value){
  20. if (value == "true"){
  21. alert("You have logged in");
  22. window.location='/logout.html'
  23. }else{
  24. alert("Incorrect Password");
  25. }
  26. }
  27. });
  28. }
  29. </script>
  30. </body>
  31. </html>