mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-19 19:59:13 +03:00
120 lines
4.8 KiB
HTML
120 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title>WireGuard UI</title>
|
|
<!-- Tell the browser to be responsive to screen width -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<!-- Font Awesome -->
|
|
<link rel="stylesheet" href="static/plugins/fontawesome-free/css/all.min.css">
|
|
<!-- Ionicons -->
|
|
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
|
<!-- icheck bootstrap -->
|
|
<link rel="stylesheet" href="static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
|
|
<!-- Theme style -->
|
|
<link rel="stylesheet" href="static/dist/css/adminlte.min.css">
|
|
<!-- Google Font: Source Sans Pro -->
|
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
|
</head>
|
|
|
|
<body class="hold-transition login-page">
|
|
<div class="login-box">
|
|
<div class="login-logo">
|
|
<a href="https://github.com/ngoduykhanh/wireguard-ui">WireGuard UI</a>
|
|
</div>
|
|
<!-- /.login-logo -->
|
|
<div class="card">
|
|
<div class="card-body login-card-body">
|
|
<p class="login-box-msg">Sign in to start your session</p>
|
|
<form action="" method="post">
|
|
<div class="input-group mb-3">
|
|
<input id="username" type="username" class="form-control" placeholder="Username">
|
|
<div class="input-group-append">
|
|
<div class="input-group-text">
|
|
<span class="fas fa-envelope"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="input-group mb-3">
|
|
<input id="password" type="password" class="form-control" placeholder="Password">
|
|
<div class="input-group-append">
|
|
<div class="input-group-text">
|
|
<span class="fas fa-lock"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<div class="icheck-primary">
|
|
<input type="checkbox" id="remember">
|
|
<label for="remember">
|
|
Remember Me
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<!-- /.col -->
|
|
<div class="col-4">
|
|
<button id="btn_login" type="button" class="btn btn-primary btn-block">Sign In</button>
|
|
</div>
|
|
<!-- /.col -->
|
|
</div>
|
|
</form>
|
|
<div class="text-center mb-3">
|
|
<p id="message"></p>
|
|
</div>
|
|
</div>
|
|
<!-- /.login-card-body -->
|
|
</div>
|
|
</div>
|
|
<!-- /.login-box -->
|
|
<!-- jQuery -->
|
|
<script src="static/plugins/jquery/jquery.min.js"></script>
|
|
<!-- Bootstrap 4 -->
|
|
<script src="static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
<!-- AdminLTE App -->
|
|
<script src="static/dist/js/adminlte.min.js"></script>
|
|
|
|
</body>
|
|
<script>
|
|
function redirectNext() {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const nextURL = urlParams.get('next');
|
|
if (nextURL) {
|
|
window.location.href = nextURL;
|
|
} else {
|
|
window.location.href = '/';
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
$(document).ready(function () {
|
|
$('#btn_login').click(function () {
|
|
const username = $("#username").val();
|
|
const password = $("#password").val();
|
|
const data = {"username": username, "password": password}
|
|
console.log(data);
|
|
|
|
$.ajax({
|
|
cache: false,
|
|
method: 'POST',
|
|
url: '/login',
|
|
dataType: 'json',
|
|
contentType: "application/json",
|
|
data: JSON.stringify(data),
|
|
success: function(data) {
|
|
document.getElementById("message").innerHTML = '<p style="color:green">' + data['message'] + '</p>';
|
|
// redirect after logging in successfully
|
|
redirectNext();
|
|
},
|
|
error: function(jqXHR, exception) {
|
|
const responseJson = jQuery.parseJSON(jqXHR.responseText);
|
|
document.getElementById("message").innerHTML = '<p style="color:red">' + responseJson['message'] + '</p>';
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</html>
|