mirror of
https://github.com/donl/gPanel.git
synced 2026-05-29 06:12:29 -06:00
99 lines
2.3 KiB
HTML
99 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Private Test</title>
|
|
<link rel="icon" type="image/x-icon" href="https://play.golang.org/favicon.ico">
|
|
</head>
|
|
<body>
|
|
<form class="api_form" method="POST" action="user_auth">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2">gPanel Login</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Username:</td>
|
|
<td><input type="text" placeholder="username..." name="user"></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Password:</td>
|
|
<td><input type="password" placeholder="password..." name="pass"></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2"><input type="submit" value="Login"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
<form class="api_form" method="POST" action="user_register">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2">gPanel Registration</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Username:</td>
|
|
<td><input type="text" placeholder="username..." name="user"></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Password:</td>
|
|
<td><input type="password" placeholder="password..." name="pass"></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2"><input type="submit" value="Register"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
<form class="api_form" method="POST" action="user_logout">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2">gPanel Logout</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="2"><input type="submit" value="Logout"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
var form = document.getElementsByClassName('api_form');
|
|
|
|
for(var i = 0; i < form.length; i++) {
|
|
form[i].onsubmit = function(e) {
|
|
e.preventDefault();
|
|
|
|
var formData = {};
|
|
for(var y = 0, yy = this.length; y < yy; y++) {
|
|
var input = this[y];
|
|
if(input.name) {
|
|
formData[input.name] = input.value;
|
|
}
|
|
}
|
|
console.log(formData); //debugging
|
|
console.log(this.action);
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open(this.method, this.action, true);
|
|
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
xhr.send(JSON.stringify(formData));
|
|
|
|
xhr.onloadend = function() {
|
|
console.log(xhr.response)
|
|
console.log(xhr.status);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|