mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-18 08:27:45 +00:00
Update login.html
This commit is contained in:
parent
132129aaf1
commit
364c304d4a
1 changed files with 54 additions and 120 deletions
|
@ -1,6 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
@ -9,54 +8,11 @@
|
||||||
<link rel="stylesheet" href="assets/css/styles.css">
|
<link rel="stylesheet" href="assets/css/styles.css">
|
||||||
<link rel="stylesheet" href="assets/css/global.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 src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
|
||||||
<script>
|
<script src="assets/js/login.js"></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;
|
|
||||||
}
|
|
||||||
|
|
||||||
function keypressing(e) {
|
|
||||||
if (!e) e = window.event;
|
|
||||||
var keyCode = e.keyCode || e.which;
|
|
||||||
if (keyCode == '13'){
|
|
||||||
doLogin();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body scroll="no">
|
<body scroll="no">
|
||||||
|
|
||||||
<div class="s-full-split s-left-half col-xs-7">
|
<div class="s-full-split s-left-half col-xs-7">
|
||||||
<div class="clearfix s-link-badge-wrapper">
|
<div class="clearfix s-link-badge-wrapper">
|
||||||
<a href="https://discord.gg/KfrZCkx" class="s-link-badge s-link-badge-discord col-xs-5">
|
<a href="https://discord.gg/KfrZCkx" class="s-link-badge s-link-badge-discord col-xs-5">
|
||||||
|
@ -67,9 +23,7 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<h2>Recent Activity</h2>
|
<h2>Recent Activity</h2>
|
||||||
<ul id="commit-log" class="commit-history">
|
<ul id="commit-log" class="commit-history"></ul>
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="s-full-split s-right-half col-xs-5">
|
<div class="s-full-split s-right-half col-xs-5">
|
||||||
<div class="s-logo">
|
<div class="s-logo">
|
||||||
|
@ -87,10 +41,10 @@
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label class="s-login-input-wrapper">
|
<label class="s-login-input-wrapper">
|
||||||
Password
|
Password
|
||||||
<input type="password" name="password" onkeypress="return keypressing(event)">
|
<input type="password" name="password">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-default s-login-btn pull-right" id="submitButton" onclick="doLogin()">Login</button>
|
<button class="btn btn-default s-login-btn pull-right" id="submitButton">Login</button>
|
||||||
<p id="Error" class="s-error-text"></p>
|
<p id="Error" class="s-error-text"></p>
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-default s-acc-btn" href="createUser.html">Create Account</a>
|
<a class="btn btn-default s-acc-btn" href="createUser.html">Create Account</a>
|
||||||
|
@ -104,26 +58,6 @@
|
||||||
|
|
||||||
<script src="assets/js/jquery.min.js"></script>
|
<script src="assets/js/jquery.min.js"></script>
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="assets/js/github.js"></script>
|
||||||
<script>
|
|
||||||
fetch( "https://api.github.com/repos/SapphireMordred/Sapphire/events" ).then( function( resp ) {
|
|
||||||
return resp.json();
|
|
||||||
}).then( function( data ) {
|
|
||||||
data = data.filter( function( e ) {
|
|
||||||
return e.type == "PushEvent";
|
|
||||||
});
|
|
||||||
|
|
||||||
let commitContainer = document.getElementById( 'commit-log' );
|
|
||||||
for ( var evnt of data ) {
|
|
||||||
for ( var commit of evnt.payload.commits ) {
|
|
||||||
let e = document.createElement( 'li' );
|
|
||||||
e.innerHTML = '<a href="https://github.com/SapphireMordred/Sapphire/commit/' + commit.sha + '">' + commit.message + '</a>';
|
|
||||||
|
|
||||||
commitContainer.appendChild( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Add table
Reference in a new issue