parent
21e7cc6509
commit
c5e8b89b7b
After Width: | Height: | Size: 355 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,39 @@
|
|||||||
|
.form-container {
|
||||||
|
margin-top: 5%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-entry{
|
||||||
|
height: 1.7rem;
|
||||||
|
width: 17rem;
|
||||||
|
border-radius: 100px;
|
||||||
|
border: var(--transparent-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.display-form{
|
||||||
|
gap: 1rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 5%;
|
||||||
|
background: var(--color-background-secondary);
|
||||||
|
border-radius: 1rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-validation-btn{
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 1rem 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-text {
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
input::placeholder {
|
||||||
|
padding-left: 1rem;
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
:root{
|
||||||
|
--color-primary : #e4f1fe;
|
||||||
|
--color-background-primary: #34495e;
|
||||||
|
--color-background-secondary: rgba(167, 224, 224, 0.3);
|
||||||
|
--color-background-secondary-hover: rgb(135, 255, 255);
|
||||||
|
--color-text-primary: #22313f;
|
||||||
|
--transparent-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body{
|
||||||
|
background-color: #ffffff;
|
||||||
|
background-image: url("../images/background.jpeg");
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
color: var(--color-text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn{
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
padding: 1rem 4.5rem;
|
||||||
|
background: var(--color-background-primary);
|
||||||
|
border-radius: 100px;
|
||||||
|
align-content: center;
|
||||||
|
border-color: transparent;
|
||||||
|
transition: 0.5s;
|
||||||
|
margin: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover{
|
||||||
|
color: var(--color-background-primary);
|
||||||
|
background: var(--color-primary);
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Maettleship</title>
|
||||||
|
<link rel="stylesheet" href="assets/styles/global.css" />
|
||||||
|
<link rel="stylesheet" href="assets/styles/formStyle.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="form-container">
|
||||||
|
<h1 class="title">Maettleship</h1>
|
||||||
|
<form id="registerForm" class="display-form">
|
||||||
|
<h1>Sign up</h1>
|
||||||
|
<input class="form-entry" type="text" id="pseudo" name="pseudo" placeholder="Pseudo" required>
|
||||||
|
<input class="form-entry" type="password" id="password" name="password" placeholder="Password" required>
|
||||||
|
|
||||||
|
<button class="btn form-validation-btn" type="submit">Sign up</button>
|
||||||
|
<div id="message"></div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p class="sub-text">Have an account ? <a href="/">Log in !</a></p>
|
||||||
|
|
||||||
|
<script src="../scripts/register.js"></script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,31 @@
|
|||||||
|
document.getElementById('registerForm').addEventListener('submit', async function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const pseudo = document.getElementById('pseudo').value;
|
||||||
|
const password = document.getElementById('password').value;
|
||||||
|
const messageDiv = document.getElementById('message');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/register', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ pseudo, password }),
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await response.json();
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
messageDiv.textContent = 'User registered successfully!';
|
||||||
|
messageDiv.style.color = 'green';
|
||||||
|
window.location.href = result.redirectUrl;
|
||||||
|
} else {
|
||||||
|
messageDiv.textContent = `Error: ${result.message || 'Unknown error'}`;
|
||||||
|
messageDiv.style.color = 'red';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
messageDiv.textContent = `Error: ${error.message}`;
|
||||||
|
messageDiv.style.color = 'red';
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in new issue