Yggdrasil/data/static/register.html
2026-01-19 20:19:19 +01:00

95 lines
3.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="
default-src 'self';
script-src 'self' https://cdnjs.cloudflare.com;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://fonts.googleapis.com;
font-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com;
connect-src 'self' https://yggdrasil.azures.fr;
">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/hung1001/font-awesome-pro@4cac1a6/css/all.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.min.css">
<title>Registration</title>
<style>
div > input {
width: 50%;
display: block;
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>
<i class="fad fa-shield-alt"></i>
Lentia Yggdrasil
</h1>
<h3>Page d'inscription</h3>
<hr>
<div>
<input type="email" placeholder="Adresse mail" id="email">
<input type="text" placeholder="Nom d'utilisateur" id="username">
<input type="password" placeholder="Mot de passe" id="password">
<button id="registerBtn">
Créer mon compte !
</button>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/js/iziToast.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const btn = document.getElementById('registerBtn');
const emailInput = document.getElementById('email');
const usernameInput = document.getElementById('username');
const passwordInput = document.getElementById('password');
async function handleRegister() {
try {
const response = await fetch("https://yggdrasil.azures.fr/register", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: emailInput.value,
username: usernameInput.value,
password: passwordInput.value
})
});
const json = await response.json();
if (json.code !== 200) {
iziToast.error({
title: json.error || "Erreur",
message: json.message || "Une erreur est survenue"
});
} else {
iziToast.success({
title: "Succès",
message: json.message
});
}
} catch (error) {
iziToast.error({
title: "Erreur",
message: "Impossible de contacter le serveur."
});
}
}
btn.addEventListener('click', handleRegister);
});
</script>
</body>
</html>