12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login</title>
- <meta name="viewport" content="width=device-width, initial-scale=1" >
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
- <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
- <style>
- .imgwrapper{
- max-height: 200px;
- overflow: hidden;
- }
- </style>
- </head>
- <body>
- <div class="navibar"></div>
- <div class="imgwrapper">
- <img src="img/wallpaper.jpg" class="ui fluid image">
- </div>
- <div class="ui container">
- <br><br>
- <div class="ui very padded text container segment">
- <h2 class="ui header">Admin Panel</h2>
- <form id="loginForm" class="ui form">
- <div class="field">
- <label>Username</label>
- <input type="text" name="username" placeholder="Username">
- </div>
- <div class="field">
- <label>Password</label>
- <input type="password" name="password" placeholder="Password">
- </div>
- <button id="loginButton" class="ui basic button" type="submit"><i class="ui blue sign-in icon"></i> Login</button>
- </form>
- </div>
- </div>
- <script>
- $(".navibar").load("navi.html");
- $('#loginForm').submit(function(e) {
- e.preventDefault(); // Prevent form submission
- // Get the input values
- var username = $('input[name="username"]').val();
- var password = $('input[name="password"]').val();
- $.ajax({
- url: "/api/auth/login?username=" + username + "&password=" + password,
- method: "POST",
- success: function(data){
- if (data.error != undefined){
- alert(data.error);
- }else{
- //Logged in
- window.location.href = "/admin/";
- }
- }
- })
- });
- </script>
- </body>
- </html>
|