166 lines
5.1 KiB
HTML
166 lines
5.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Signup | {{ appName }}</title>
|
|
</head>
|
|
<body>
|
|
<style>
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
background-color: #f8f8f8;
|
|
background-image: radial-gradient(#d1d1d1 1px, transparent 1px);
|
|
background-size: 20px 20px;
|
|
margin: 0;
|
|
padding: 16px;
|
|
}
|
|
|
|
.login {
|
|
background-color: white;
|
|
padding: 40px;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
width: 100%;
|
|
max-width: 380px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
color: #1f2937;
|
|
margin: 0;
|
|
}
|
|
|
|
.header p {
|
|
margin-top: 8px;
|
|
font-size: 14px;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.button {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 8px 20px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
color: #4b5563;
|
|
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
|
}
|
|
|
|
.button:hover {
|
|
background-color: #f3f4f6;
|
|
border-color: #e5e7eb;
|
|
}
|
|
|
|
.button img {
|
|
width: 20px;
|
|
height: 20px;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.emaillogin {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.input {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.loginbutton {
|
|
background-color: #1f2937;
|
|
color: white;
|
|
border: 1px solid #1f2937;
|
|
padding: 12px 20px;
|
|
}
|
|
|
|
.loginbutton:hover {
|
|
background-color: #374151;
|
|
border-color: #374151;
|
|
}
|
|
|
|
.footer {
|
|
margin-top: 24px;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.footer a {
|
|
color: #1f2937;
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
<div class="login">
|
|
<div class="header">
|
|
<h1>Sign up with {{ appName }}</h1>
|
|
<p>Complete your details below</p>
|
|
</div>
|
|
<div class="emaillogin">
|
|
<input id="userbox" class="input" type="text" name="username" placeholder="Username">
|
|
<input id="displaybox" class="input" type="text" name="display" placeholder="Display Name">
|
|
<input id="codebox" class="input" type="text" name="code" placeholder="Signup Code">
|
|
<p id="incorrectdetailstext" style="display: none;">Invalid Code</p>
|
|
</div>
|
|
<a onclick="oauthsignup(document.getElementById('userbox').value, document.getElementById('displaybox').value, document.getElementById('codebox').value)" class="button loginbutton">Login</a>
|
|
<div class="footer">
|
|
<p>Have an account? <a href="{{ url_for('index') }}">Log in</a></p>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
async function oauthsignup(user, display, code) {
|
|
try {
|
|
let params = new URLSearchParams(document.location.search);
|
|
const response = await fetch("{{ url_for('handleOauthSignup') }}", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({ "username": user, "display":display, "code":"{{ accessToken }}", "signupcode":code, "provider":"{{ provider }}" }),
|
|
});
|
|
if (!response.ok) {
|
|
throw new Error(`Response status: ${response.status}`);
|
|
}
|
|
const result = await response.json();
|
|
if (result != "Code not found" && response != "Signups have been disabled" && result != "User already exists" && result != "An error occured") {
|
|
console.log(result)
|
|
//document.location.href = "{{ url_for('index') }}"
|
|
} else {
|
|
document.getElementById("incorrectdetailstext").style = "display: block;"
|
|
}
|
|
} catch (error) {
|
|
console.error(error.message)
|
|
}
|
|
return false
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |