279 lines
8.1 KiB
Plaintext
279 lines
8.1 KiB
Plaintext
<!-- Note: 'sop' stands for Sign On Page -->
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="./bulma/css/bulma.css">
|
|
<title></title>
|
|
</head>
|
|
<body>
|
|
<header></header>
|
|
<main>
|
|
<div class="container">
|
|
<div class="columns is-centered is-vcentered min-height-screen">
|
|
<div class="column is-one-third ">
|
|
|
|
<div class="has-text-centered mb-5">
|
|
<figure class="image is-96x96 mx-auto mb-2">
|
|
<img src="./assets/sop/cpc.png" />
|
|
</figure>
|
|
<h1 class="title is-5" style="color: #00ff8c">Computer Programming Club</h1>
|
|
<p class="subtitle is-7 mt-2" style="color: #e28a1d">University Of Wisconsin - Platteville</p>
|
|
</div>
|
|
|
|
<form class="box" id="form">
|
|
<label class="label my-4 required">Email</label>
|
|
<div class="control has-icons-left">
|
|
<input class="input" type="email" id="email-box" placeholder="[email protected]" />
|
|
<span class="icon is-small is-left">
|
|
<ion-icon name="mail"></ion-icon>
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="field mb-5">
|
|
<label class="label my-4 required">Password</label>
|
|
<div class="control has-icons-left">
|
|
<input class="input" type="password" id="password-box" placeholder="******" />
|
|
<span class="icon is-small is-left">
|
|
<ion-icon name="lock-closed"></ion-icon>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="inner-registration-form">
|
|
<label class="label mt-4 required">Confirm Password</label>
|
|
<div class="control has-icons-left">
|
|
<input class="input" type="password" placeholder="******" />
|
|
<span class="icon is-small is-left">
|
|
<ion-icon name="lock-closed"></ion-icon>
|
|
</span>
|
|
</div>
|
|
|
|
<label class="label mt-4 required">Full Name</label>
|
|
<div class="control has-icons-left">
|
|
<input class="input" type="text" placeholder="John Doe" id="name-box" />
|
|
<span class="icon is-small is-left">
|
|
<ion-icon name="person"></ion-icon>
|
|
</span>
|
|
</div>
|
|
|
|
<label class="label mt-4 required">User Type <a>(?)</a></label>
|
|
<div class="select">
|
|
<select id="type-box">
|
|
<option value="?">Select</option>
|
|
<option value="member">CPC Member</option>
|
|
<option value="exto">External Club Officer</option>
|
|
<option value="faculty">UW-Platt Faculty</option>
|
|
<option value="student">UW-Platt Student</option>
|
|
<option value="employer">Employer/Recruiter</option>
|
|
</select>
|
|
|
|
|
|
</div>
|
|
<br>
|
|
|
|
<button class="button is-primary mt-5" type="button" id="register-btn-inner" onclick="register_account()">Register</button>
|
|
|
|
</div>
|
|
|
|
<button class="button is-primary mr-1" id="login-btn">Login</button>
|
|
<button class="button is-secondary" onclick="transition_sign_up()" type="button" id="register-btn">Register</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</main>
|
|
<footer></footer>
|
|
</body>
|
|
|
|
<style>
|
|
|
|
|
|
.min-height-screen {
|
|
min-height: 100vh;
|
|
}
|
|
|
|
|
|
#form {
|
|
overflow: hidden;
|
|
height: 320px;
|
|
transition: height 3s ease;
|
|
}
|
|
|
|
#inner-registration-form {
|
|
opacity: 0;
|
|
display: none;
|
|
}
|
|
|
|
#form.registering {
|
|
height: 580px;
|
|
}
|
|
|
|
#form.registering #inner-registration-form {
|
|
display: block;
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
.required:after {
|
|
content:" *";
|
|
color: red;
|
|
}
|
|
|
|
|
|
.btnfade {
|
|
animation-name: fade-btn;
|
|
animation-duration: 0s;
|
|
animation-fill-mode: forwards;
|
|
}
|
|
|
|
@keyframes fade-btn {
|
|
from {
|
|
opacity: 100%;
|
|
|
|
}
|
|
to {
|
|
opacity: 0%;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
async function listen_for_otp() {
|
|
|
|
const inputs = document.getElementById("inputs");
|
|
|
|
inputs.addEventListener("input", function (e) {
|
|
const target = e.target;
|
|
const val = target.value;
|
|
|
|
if (isNaN(val)) {
|
|
target.value = "";
|
|
return;
|
|
}
|
|
|
|
if (val != "") {
|
|
const next = target.nextElementSibling;
|
|
if (next) {
|
|
next.focus();
|
|
}
|
|
}
|
|
});
|
|
|
|
inputs.addEventListener("keyup", function (e) {
|
|
const target = e.target;
|
|
const key = e.key.toLowerCase();
|
|
|
|
if (key == "backspace" || key == "delete") {
|
|
target.value = "";
|
|
const prev = target.previousElementSibling;
|
|
if (prev) {
|
|
prev.focus();
|
|
}
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
async function transition_sign_up() {
|
|
document.getElementById('form').classList.add('registering');
|
|
document.getElementById('login-btn').classList.add('btnfade');
|
|
document.getElementById('register-btn').classList.add('btnfade');
|
|
}
|
|
|
|
async function register_account() {
|
|
const button = document.getElementById('register-btn-inner');
|
|
const email = document.getElementById('email-box');
|
|
const password = document.getElementById('password-box');
|
|
const name = document.getElementById('name-box');
|
|
const type = document.getElementById('type-box');
|
|
const form = document.getElementById('form');
|
|
|
|
console.log(type.value);
|
|
|
|
button.disabled = true;
|
|
|
|
const response = await fetch("/api/accounts/register", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json"
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
email: email.value,
|
|
password: password.value,
|
|
name: name.value,
|
|
type: type.value
|
|
})
|
|
});
|
|
|
|
|
|
const html = await response.text();
|
|
|
|
if (response.ok) {
|
|
form.innerHTML = html;
|
|
listen_for_otp();
|
|
} else {
|
|
try {
|
|
document.getElementById('notif').remove();
|
|
}
|
|
|
|
catch {
|
|
;
|
|
}
|
|
|
|
const div = document.createElement("div");
|
|
const button = document.createElement("button");
|
|
button.className = "delete"
|
|
button.addEventListener('click', () => document.getElementById('notif').remove());
|
|
div.className = "notification is-danger";
|
|
div.id = "notif"
|
|
div.textContent = html;
|
|
div.appendChild(button);
|
|
document.body.insertBefore(div, document.body.firstChild);
|
|
|
|
}
|
|
|
|
button.disabled = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
|
|
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
|
|
|
|
|
|
</html>
|