first commit
This commit is contained in:
BIN
server/front/login/background-image.jpeg
Normal file
BIN
server/front/login/background-image.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
27
server/front/login/index.html
Normal file
27
server/front/login/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="glass-container">
|
||||
<div class="login-box">
|
||||
<h2>Login</h2>
|
||||
<form action="#" method="POST">
|
||||
<input type="text" id="username" name="username" required placeholder="Username">
|
||||
<input type="password" id="password" name="password" required placeholder="Password">
|
||||
<div class="options">
|
||||
<input type="checkbox" id="remember" name="remember">
|
||||
<label for="remember"> Remember me</label>
|
||||
<a href="#">Forgot Password?</a>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
<p>Don't have an account? <a href="./../register/index.html" id="register">Register</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
121
server/front/login/style.css
Normal file
121
server/front/login/style.css
Normal file
@@ -0,0 +1,121 @@
|
||||
* {
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-image: url('background-image.jpeg');
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.glass-container {
|
||||
width: 300px;
|
||||
height: 350px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.glass-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
max-width: 250px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #fff;
|
||||
margin-top: 30px;
|
||||
margin-bottom: -20px;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px;
|
||||
margin-top: 25px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.options {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.options input {
|
||||
margin-right: 5px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.options a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #fff;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: transparent;
|
||||
color: white;
|
||||
outline: 1px solid #fff;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#register {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
19
server/front/main/index.html
Normal file
19
server/front/main/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Main</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="glass-container">
|
||||
<div class="data-box">
|
||||
<h2>data</h2>
|
||||
<form action="#" method="POST">
|
||||
<p>Data</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
60
server/front/main/style.css
Normal file
60
server/front/main/style.css
Normal file
@@ -0,0 +1,60 @@
|
||||
* {
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-image: url('./../login/background-image.jpeg');
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.glass-container {
|
||||
width: 600px;
|
||||
height: 700px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.glass-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.data-box {
|
||||
max-width: 250px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #fff;
|
||||
margin-top: 30px;
|
||||
margin-bottom: -20px;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
}
|
||||
p {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
margin-top: 15px;
|
||||
}
|
||||
24
server/front/register/index.html
Normal file
24
server/front/register/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Register</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="glass-container" id="glass-container">
|
||||
<div class="register-box">
|
||||
<h2>Register</h2>
|
||||
<form id="registerForm">
|
||||
<input type="text" id="email" name="email" required placeholder="Email">
|
||||
<input type="password" id="password" name="password" required placeholder="Password">
|
||||
<input type="password" id="confirm_password" name="confirm_password" required placeholder="Repeat the password">
|
||||
<button type="submit">Register</button>
|
||||
<p>Do you have an account? <a href="./../login/index.html" id="Login">Login</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
70
server/front/register/js.js
Normal file
70
server/front/register/js.js
Normal file
@@ -0,0 +1,70 @@
|
||||
document.getElementById('registerForm').addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const email = document.getElementById('email').value;
|
||||
const password = document.getElementById('password').value;
|
||||
const confirmPassword = document.getElementById('confirm_password').value;
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
showError(['Passwords are different!']);
|
||||
return;
|
||||
}
|
||||
|
||||
const userData = {
|
||||
email,
|
||||
description: "string",
|
||||
activated: true,
|
||||
password
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch('http://localhost:8000/user_create', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(userData)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
window.location.href = './../login/index.html';
|
||||
} else {
|
||||
const err = await response.json();
|
||||
if (Array.isArray(err.detail)) {
|
||||
const messages = err.detail.map(e => {
|
||||
const field = e.loc.filter(locPart => locPart !== 'body').join(' -> ');
|
||||
return `${field}: ${e.msg}`;
|
||||
});
|
||||
showError(messages);
|
||||
} else if (typeof err.detail === 'string') {
|
||||
showError([err.detail]);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
showError(['Connection timeout']);
|
||||
}
|
||||
});
|
||||
|
||||
function showError(messages) {
|
||||
let errorElem = document.getElementById('formError');
|
||||
let container = document.getElementById('glass-container');
|
||||
if (!errorElem) {
|
||||
errorElem = document.createElement('div');
|
||||
errorElem.style.transition = "3s";
|
||||
errorElem.id = 'formError';
|
||||
errorElem.style.color = 'red';
|
||||
errorElem.style.marginTop = '20px';
|
||||
errorElem.style.fontSize = "14px";
|
||||
errorElem.style.fontWeight="100";
|
||||
errorElem.style.marginBottom='20px';
|
||||
errorElem.style.lineHeight = "120%";
|
||||
container.style.height = "auto";
|
||||
const form = document.getElementById('registerForm');
|
||||
form.insertAdjacentElement('afterend', errorElem);
|
||||
}
|
||||
errorElem.innerHTML = '';
|
||||
messages.forEach(msg => {
|
||||
const li = document.createElement('li');
|
||||
li.style.listStyleType="none";
|
||||
li.textContent = msg;
|
||||
errorElem.appendChild(li);
|
||||
});
|
||||
}
|
||||
102
server/front/register/style.css
Normal file
102
server/front/register/style.css
Normal file
@@ -0,0 +1,102 @@
|
||||
* {
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-image: url('./../login/background-image.jpeg');
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.glass-container {
|
||||
width: 300px;
|
||||
height: 350px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.glass-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.register-box {
|
||||
max-width: 250px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #fff;
|
||||
margin-top: 30px;
|
||||
margin-bottom: -20px;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px;
|
||||
margin-top: 25px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #fff;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: transparent;
|
||||
color: white;
|
||||
outline: 1px solid #fff;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#Login {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
Reference in New Issue
Block a user