AIRA/src/frontend/login.html

212 lines
7.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AIRA - Login</title>
<link rel="stylesheet" href="/static/commons/style.css">
<style>
:root {
--accent: #FF3C00;
--transparent: #00000000;
}
html {
height: 100%;
font-family: Arial, Helvetica, Sans-Serif;
color: white;
}
body {
margin: 0;
height: 100%;
background-image: url("/static/imgs/wallpaper");
background-repeat: no-repeat;
background-position: center;
background-color: black;
}
main {
max-width: 900px;
background-color: #2B2F31;
border-radius: 10px;
position: absolute;
top: 20vh;
left: 0;
right: 0;
margin: auto;
padding-bottom: 20px;
}
h1, main>h3, #error_msg {
text-align: center;
}
h1 {
font-size: 3em;
margin-bottom: 0;
}
main>h3 {
font-style: italic;
color: #7E8183;
}
#error_msg {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 0;
}
#panel_container {
display: grid;
grid-template-columns: 50% 50%;
position: relative;
}
input[type="text"], input[type="password"] {
margin-bottom: 20px;
}
button {
background-color: #52585C;
color: white;
cursor: pointer;
padding: 15px 20%;
border: none;
border-radius: 8px;
display: block;
margin: auto;
}
button:hover {
background-color: var(--accent);
}
.panel {
padding: 10px 50px;
}
#separator {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
background-color: var(--accent);
height: 30%;
width: 2px;
}
label {
background-color: #32383C;
padding: 20px;
border-radius: 8px;
margin-bottom: 10px;
display: grid;
grid-template-columns: auto 0 min-content;
grid-gap: 0.5em;
align-items: center;
}
label:hover {
background-color: #42484C;
}
label>div {
display: flex;
align-items: center;
}
label .avatar {
width: 2em;
height: 2em;
font-size: 1.3em;
}
input[type="radio"] {
opacity: 0;
width: 0;
height: 0;
}
.radio_checkmark {
display: flex;
width: 1.5em;
height: 1.5em;
background-color: #52585C;
border-radius: 50%;
align-items: center;
justify-content: center;
}
input[type="radio"]:checked + .radio_checkmark {
background-color: #282D2F;
}
input[type="radio"]:checked + .radio_checkmark::after {
display: block;
}
.radio_checkmark::after {
display: none;
content: "";
width: .5em;
height: .5em;
border-radius: 50%;
background-color: var(--accent);
}
#left_panel.no_identity {
display: none;
}
p {
color: red;
}
main.no_identity #panel_container {
display: block;
}
main.no_identity #left_panel, main.no_identity #separator {
display: none;
}
main.no_identity {
max-width: 500px;
}
</style>
</head>
<body>
<main id="main">
<h1>AIRA</h1>
<h3>Local network secure P2P communications</h3>
<p id="error_msg">ERROR_MSG</p>
<div id="panel_container">
<div id="left_panel" class="panel">
<h2>Login:</h2>
<form id="login_form" method="POST" action="/login">
<div id="identities">
</div>
<input name="password" type="password" placeholder="Password">
<button type="submit">Login</button>
</form>
</div>
<span id="separator"></span>
<div id="right_panel" class="panel">
<h2>Create New Identity:</h2>
<form method="POST">
<input type="text" name="name" placeholder="Name" required>
<input type="password" name="password" placeholder="Password">
<input type="password" name="password_confirm" placeholder="Password (Confirmation)">
<button type="submit">Create</button>
</form>
</div>
</div>
</main>
<script src="/static/commons/script.js"></script>
<script>
const identities = [IDENTITIES];
if (identities.length > 0) {
let identities_container = document.getElementById("identities");
identities.forEach(function(identity) {
let div = document.createElement("div");
div.appendChild(generate_avatar(identity[1]));
let radio_label = document.createElement("span");
radio_label.classList.add("radio_label");
radio_label.appendChild(document.createTextNode(identity[1]));
div.appendChild(radio_label);
let label = document.createElement("label");
label.appendChild(div);
let input = document.createElement("input");
input.type = "radio";
input.name = "uuid";
input.value = identity[0];
input.required = true;
label.appendChild(input);
let radio_checkmark = document.createElement("span");
radio_checkmark.classList.add("radio_checkmark");
label.appendChild(radio_checkmark);
identities_container.appendChild(label);
});
} else {
let main = document.getElementById("main");
main.classList.add("no_identity");
}
</script>
</body>
</html>