login.html 861 B

123456789101112131415161718192021222324252627282930313233
  1. <html>
  2. <head>
  3. <title>Login</title>
  4. <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  5. </script>
  6. </head>
  7. <body>
  8. <h1>Admin Login</h1>
  9. <p>Please enter your password here</p>
  10. <input id="password" type="password">
  11. <button onclick="handleLogin()">Login</button>
  12. <script>
  13. function handleLogin() {
  14. var password = $("#password").val();
  15. $.ajax({
  16. url: "/login",
  17. data: {password: password},
  18. success: function(value){
  19. var response = JSON.parse(value)
  20. if (response.Matched == true){
  21. alert("Sucess! 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>