Initial Commit
This commit is contained in:
commit
c1c292c437
7 changed files with 261 additions and 0 deletions
32
account/accounts.js
Normal file
32
account/accounts.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const requestAddr = "https://account.spfn.net/api/v2/oauth2/generate_token"
|
||||
|
||||
document.getElementById("login").addEventListener("submit", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const username = document.getElementById("username").value;
|
||||
const password = document.getElementById("password").value;
|
||||
|
||||
const credentials = btoa(`${username} ${password}`);
|
||||
|
||||
fetch(requestAddr, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Authorization": credentials,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error("Network Response was not okay");
|
||||
return response.json();
|
||||
})
|
||||
.then(data => { // Success - Hide Form and Show Info on Screen
|
||||
document.getElementById("username").value = `SFID: ${data["username"]}`
|
||||
|
||||
document.getElementById("email").value = data["email"];
|
||||
document.getElementById("dob").value = data["birthdate"];
|
||||
document.getElementById("tz").value = data["timezone"];
|
||||
document.getElementById("region").value = data["region"];
|
||||
|
||||
document.getElementById("login").style.display = "none";
|
||||
document.getElementById("user-info").style.display = "flex";
|
||||
})
|
||||
})
|
||||
57
account/index.html
Normal file
57
account/index.html
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Account | SPFN</title>
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div>
|
||||
<img rel="icon" href="/logo.ico" type="image/x-icon">
|
||||
<h1>SPFN</h1>
|
||||
</div>
|
||||
<nav>
|
||||
<ul class="nav-links">
|
||||
<a href="/"><button class="header-button">Home</button></a>
|
||||
<a href="/guides"><button class="header-button">Guides</button></a>
|
||||
<a href="/account"><button class="header-button">Account</button></a>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<h2>Accounts</h2>
|
||||
|
||||
<form id="login">
|
||||
<h3 class="center">Please log in before viewing account information</h3>
|
||||
<div class="form-group">
|
||||
<label for="username">SFID:</label>
|
||||
<input type="text" id="username" name="username" required />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" name="password" required />
|
||||
</div>
|
||||
<button type="submit" style="font-size: 24px;">Login</button>
|
||||
<p class="center" style="font-size: 12px;">Please ask an SPFN Developer in the <a href="https://discord.gg/grMSxZf">discord server</a> for assistance with password resets</p>
|
||||
</form>
|
||||
|
||||
<div id="user-info" class="info" style="display: none;">
|
||||
<div id="user-display" class="info-container" style="width: 180px">
|
||||
<h3 id="display-name" style="margin: 2px;">Display Name</h3>
|
||||
<p id="username" style="margin: 2px;">SFID: Username</p>
|
||||
</div>
|
||||
<div id="user-details" class="info-container", style="flex: 1;">
|
||||
<p class="info-text" id="email"><strong>Email: </strong>name@domain.com</p>
|
||||
<p class="info-text" id="dob"><strong>Date of Birth: </strong>dd/mm/yyyy</p>
|
||||
<p class="info-text" id="tz"><strong>Timezone: </strong>Europe/London</p>
|
||||
<p class="info-text" id="region"><strong>Country/Region: </strong>GB</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="accounts.js"></script>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p class="center">Need assistance? <a href="https://discord.gg/grMSxZf">Join the Discord</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue