mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
106 lines
No EOL
3.3 KiB
HTML
106 lines
No EOL
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Sapphire - Login</title>
|
|
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="assets/css/styles.css">
|
|
<link rel="stylesheet" href="assets/css/global.css">
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
|
|
<script>
|
|
function doLogin(){
|
|
var url = "sapphire-api/lobby/login";
|
|
var params = "{\"username\":\"" + document.getElementsByName('username')[0].value + "\",\"pass\":\"" + document.getElementsByName('password')[0].value + "\"}";
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("POST", url, true);
|
|
|
|
xhr.onreadystatechange = function() {
|
|
if (xhr.readyState == 4) {
|
|
try{
|
|
var response = readBody(xhr);
|
|
var parsed = JSON.parse(response);
|
|
window.external.Boot(parsed.sId, parsed.lobbyHost, parsed.frontierHost);
|
|
}catch(err){
|
|
document.getElementById("Error").innerHTML = "Login failed.";
|
|
}
|
|
}
|
|
}
|
|
|
|
xhr.send(params);
|
|
}
|
|
|
|
function readBody(xhr) {
|
|
var data;
|
|
if (!xhr.responseType || xhr.responseType === "text") {
|
|
data = xhr.responseText;
|
|
} else if (xhr.responseType === "document") {
|
|
data = xhr.responseXML;
|
|
} else {
|
|
data = xhr.response;
|
|
}
|
|
return data;
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body scroll="no">
|
|
<div class="s-full-split s-left-half col-xs-7">
|
|
<div class="clearfix s-link-badge-wrapper">
|
|
<a href="https://discord.gg/KfrZCkx" target="_blank" class="s-link-badge s-link-badge-discord col-xs-5">
|
|
Join us on Discord!
|
|
</a>
|
|
<a href="https://github.com/SapphireMordred/Sapphire" target="_blank" class="s-link-badge s-link-badge-github col-xs-5 pull-left">
|
|
Our Github repository
|
|
</a>
|
|
</div>
|
|
<h2>Github stuff here soon!</h2>
|
|
</div>
|
|
<div class="s-full-split s-right-half col-xs-5">
|
|
<div class="s-logo">
|
|
<img src="assets/img/sapphire_logo_resize.png">
|
|
</div>
|
|
<div class="s-login-box col-xs-12">
|
|
<div class="s-login-box-form">
|
|
<h1 class="text-center s-login-call">Login to Account</h1>
|
|
<div class="input-control">
|
|
<label class="s-login-input-wrapper">
|
|
Username
|
|
<input type="text" name="username" autofocus>
|
|
</label>
|
|
</div>
|
|
<div class="input-control">
|
|
<label class="s-login-input-wrapper">
|
|
Password
|
|
<input type="password" name="password">
|
|
</label>
|
|
</div>
|
|
<button class="btn btn-default s-login-btn pull-right" id="submitButton" onclick="doLogin()">Login</button>
|
|
<p id="Error" class="s-error-text"></p>
|
|
</div>
|
|
<a class="btn btn-default s-acc-btn" href="createUser.html">Create Account</a>
|
|
</div>
|
|
<div class="s-gears">
|
|
<img class="s-gears" src="assets/img/graffletopia-gears.png" alt="">
|
|
</div>
|
|
</div>
|
|
<div id="TopDiv"></div>
|
|
<div class="container"></div>
|
|
|
|
<script src="assets/js/jquery.min.js"></script>
|
|
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
|
|
<script> // Run only after jq and bootstrap have finished loading
|
|
|
|
// Work around non-HTML5 compliant IE autofocus
|
|
$(function() {
|
|
$('[autofocus]:not(:focus)').eq(0).focus();
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |