Prettier
This commit is contained in:
@@ -4,13 +4,13 @@ html {
|
||||
--background-primary: rgb(22, 23, 25);
|
||||
--background-secondary: rgb(15, 16, 18);
|
||||
--foreground-primary: rgb(200, 200, 200);
|
||||
--background-login-discord: #5865F2;
|
||||
--background-login-discord: #5865f2;
|
||||
|
||||
background: url("https://slowcord.maddy.k.vu/assets/background.png");
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
|
||||
color: var(--foreground-primary);
|
||||
}
|
||||
@@ -55,7 +55,8 @@ html {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header-subtext a, .header-subtext p {
|
||||
.header-subtext a,
|
||||
.header-subtext p {
|
||||
display: inline-block;
|
||||
margin: 0 10px 0 10px;
|
||||
}
|
||||
@@ -109,4 +110,4 @@ label {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,12 @@ const handleSubmit = async (path, body) => {
|
||||
}
|
||||
|
||||
// Very fun error message here lol
|
||||
const error =
|
||||
json.errors
|
||||
? Object.values(json.errors)[0]._errors[0].message
|
||||
: (
|
||||
json.captcha_key ? "Captcha required" : json.message
|
||||
);
|
||||
const error = json.errors
|
||||
? Object.values(json.errors)[0]._errors[0].message
|
||||
: json.captcha_key
|
||||
? "Captcha required"
|
||||
: json.message;
|
||||
|
||||
failureMessage.innerHTML = error;
|
||||
failureMessage.style.display = "block";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,103 +1,127 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Slowcord</title>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Slowcord</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="./css/index.css" />
|
||||
<script src="js/handler.js"></script>
|
||||
</head>
|
||||
|
||||
<link rel="stylesheet" href="./css/index.css">
|
||||
<script src="js/handler.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="login">
|
||||
<div class="header">
|
||||
<h1>Welcome to Slowcord</h1>
|
||||
<div class="header-subtext">
|
||||
<p>Glad to see you <3</p>
|
||||
<a href="/register">Wait, I'm new!</a>
|
||||
</div>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="login">
|
||||
<div class="header">
|
||||
<h1>Welcome to Slowcord</h1>
|
||||
<div class="header-subtext">
|
||||
<p>Glad to see you <3 </p>
|
||||
<a href="/register">Wait, I'm new!</a>
|
||||
<p id="failure">Login failed</p>
|
||||
</div>
|
||||
|
||||
<p id="failure">Login failed</p>
|
||||
<form action="javascript:void(0);" name="login">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" value="Login" />
|
||||
|
||||
<a
|
||||
id="loginDiscord"
|
||||
class="oauth"
|
||||
href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email"
|
||||
>
|
||||
Login with Discord
|
||||
</a>
|
||||
|
||||
<div
|
||||
class="h-captcha"
|
||||
data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8"
|
||||
data-theme="dark"
|
||||
></div>
|
||||
<script
|
||||
src="https://js.hcaptcha.com/1/api.js"
|
||||
async
|
||||
defer
|
||||
></script>
|
||||
</form>
|
||||
|
||||
<form
|
||||
action="javascript:void(0);"
|
||||
name="2fa"
|
||||
style="display: none"
|
||||
>
|
||||
<label for="code">2FA Code</label>
|
||||
<input type="number" name="code" />
|
||||
|
||||
<input type="hidden" name="ticket" />
|
||||
|
||||
<input type="submit" value="Login" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form action="javascript:void(0);" name="login">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" value="Login" />
|
||||
|
||||
<a id="loginDiscord" class="oauth"
|
||||
href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email">
|
||||
Login with Discord
|
||||
</a>
|
||||
|
||||
<div class="h-captcha" data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8" data-theme="dark"></div>
|
||||
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||
</form>
|
||||
|
||||
<form action="javascript:void(0);" name="2fa" style="display: none">
|
||||
<label for="code">2FA Code</label>
|
||||
<input type="number" name="code" />
|
||||
|
||||
<input type="hidden" name="ticket" />
|
||||
|
||||
<input type="submit" value="Login"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript */
|
||||
const getCookieValue = (name) => (
|
||||
document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''
|
||||
);
|
||||
<script>
|
||||
/* https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript */
|
||||
const getCookieValue = (name) =>
|
||||
document.cookie
|
||||
.match("(^|;)\\s*" + name + "\\s*=\\s*([^;]+)")
|
||||
?.pop() || "";
|
||||
|
||||
let token = getCookieValue("token");
|
||||
if (token.trim().length) {
|
||||
/* https://stackoverflow.com/a/27374365 */
|
||||
// why is clearing cookies so weird? wtf
|
||||
document.cookie.split(";").forEach(function (c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/"); });
|
||||
window.localStorage.setItem("token", `"${token}"`);
|
||||
window.location.href = "/app";
|
||||
}
|
||||
let token = getCookieValue("token");
|
||||
if (token.trim().length) {
|
||||
/* https://stackoverflow.com/a/27374365 */
|
||||
// why is clearing cookies so weird? wtf
|
||||
document.cookie.split(";").forEach(function (c) {
|
||||
document.cookie = c
|
||||
.replace(/^ +/, "")
|
||||
.replace(
|
||||
/=.*/,
|
||||
"=;expires=" + new Date().toUTCString() + ";path=/",
|
||||
);
|
||||
});
|
||||
window.localStorage.setItem("token", `"${token}"`);
|
||||
window.location.href = "/app";
|
||||
}
|
||||
|
||||
token = window.localStorage.getItem("token");
|
||||
if (token) window.location.href = "/app";
|
||||
token = window.localStorage.getItem("token");
|
||||
if (token) window.location.href = "/app";
|
||||
|
||||
document.forms["login"].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const email = data.get("email");
|
||||
const password = data.get("password");
|
||||
const hcaptcha = data.get("h-captcha-response");
|
||||
document.forms["login"].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const email = data.get("email");
|
||||
const password = data.get("password");
|
||||
const hcaptcha = data.get("h-captcha-response");
|
||||
|
||||
await handleSubmit("/api/v9/auth/login", {
|
||||
login: email,
|
||||
password: password,
|
||||
captcha_key: hcaptcha,
|
||||
await handleSubmit("/api/v9/auth/login", {
|
||||
login: email,
|
||||
password: password,
|
||||
captcha_key: hcaptcha,
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
document.forms["2fa"].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const code = data.get("code");
|
||||
const ticket = data.get("ticket");
|
||||
document.forms["2fa"].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const code = data.get("code");
|
||||
const ticket = data.get("ticket");
|
||||
|
||||
await handleSubmit("/api/v9/auth/mfa/totp", {
|
||||
code: code,
|
||||
ticket: ticket,
|
||||
await handleSubmit("/api/v9/auth/mfa/totp", {
|
||||
code: code,
|
||||
ticket: ticket,
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,78 +1,88 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Slowcord</title>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Slowcord</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="./css/index.css" />
|
||||
<script src="js/handler.js"></script>
|
||||
</head>
|
||||
|
||||
<link rel="stylesheet" href="./css/index.css">
|
||||
<script src="js/handler.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="login">
|
||||
<div class="header">
|
||||
<h1>Welcome to Slowcord</h1>
|
||||
<div class="header-subtext">
|
||||
<p>You're new?</p>
|
||||
<a href="/login">Actually, I'm not!</a>
|
||||
</div>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="login">
|
||||
<div class="header">
|
||||
<h1>Welcome to Slowcord</h1>
|
||||
<div class="header-subtext">
|
||||
<p>You're new?</p>
|
||||
<a href="/login">Actually, I'm not!</a>
|
||||
<p id="failure">Register failed</p>
|
||||
</div>
|
||||
|
||||
<p id="failure">Register failed</p>
|
||||
<form action="javascript:void(0);">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" />
|
||||
|
||||
<label for="username">Username</label>
|
||||
<input type="username" name="username" />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<label for="dob">Date of Birth</label>
|
||||
<input type="date" name="dob" />
|
||||
|
||||
<input type="submit" value="Register" />
|
||||
|
||||
<a
|
||||
id="loginDiscord"
|
||||
class="oauth"
|
||||
href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email"
|
||||
>
|
||||
Login with Discord
|
||||
</a>
|
||||
|
||||
<div
|
||||
class="h-captcha"
|
||||
data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8"
|
||||
></div>
|
||||
<script
|
||||
src="https://js.hcaptcha.com/1/api.js"
|
||||
async
|
||||
defer
|
||||
></script>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<form action="javascript:void(0);">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" name="email" />
|
||||
|
||||
<label for="username">Username</label>
|
||||
<input type="username" name="username" />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<label for="dob">Date of Birth</label>
|
||||
<input type="date" name="dob" />
|
||||
|
||||
<input type="submit" value="Register" />
|
||||
|
||||
<a id="loginDiscord" class="oauth"
|
||||
href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email">
|
||||
Login with Discord
|
||||
</a>
|
||||
|
||||
<div class="h-captcha" data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8"></div>
|
||||
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.forms[0].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const email = data.get("email");
|
||||
const username = data.get("username");
|
||||
const password = data.get("password");
|
||||
const dob = data.get("dob");
|
||||
const hcaptcha = data.get("h-captcha-response")
|
||||
<script>
|
||||
document.forms[0].addEventListener("submit", async (e) => {
|
||||
const data = new FormData(e.target);
|
||||
const email = data.get("email");
|
||||
const username = data.get("username");
|
||||
const password = data.get("password");
|
||||
const dob = data.get("dob");
|
||||
const hcaptcha = data.get("h-captcha-response");
|
||||
|
||||
await handleSubmit("/api/v9/auth/register", {
|
||||
consent: true,
|
||||
email: email,
|
||||
username: username,
|
||||
password: password,
|
||||
date_of_birth: dob,
|
||||
captcha_key: hcaptcha,
|
||||
await handleSubmit("/api/v9/auth/register", {
|
||||
consent: true,
|
||||
email: email,
|
||||
username: username,
|
||||
password: password,
|
||||
date_of_birth: dob,
|
||||
captcha_key: hcaptcha,
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user