Added a new registration HTML page under data/static/register.html and introduced a static file serving route in routes/static.js. Minor adjustments were made to authRepository.js and userRepository.js to update module imports. This enables serving static assets and provides a registration UI.
60 lines
1.9 KiB
HTML
60 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<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>
|
||
</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 onclick="register()">
|
||
Créer mon compte !
|
||
</button>
|
||
</div>
|
||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/js/iziToast.min.js"></script>
|
||
<style>
|
||
div > input {
|
||
width: 50%;
|
||
}
|
||
</style>
|
||
<script>
|
||
|
||
async function register() {
|
||
const response = await fetch("https://yggdrasil.azures.fr/register", {
|
||
method: "POST",
|
||
headers: {
|
||
"content-type": "application/json"
|
||
},
|
||
body: JSON.stringify({
|
||
email: email.value,
|
||
username: username.value,
|
||
password: password.value
|
||
})
|
||
})
|
||
const json = await response.json()
|
||
if (json.code != 200) {
|
||
return iziToast.error({ title: json.error, message: json.message })
|
||
} else {
|
||
console.log(json)
|
||
return iziToast.success({ title: "Succès", message: json.message })
|
||
}
|
||
}
|
||
|
||
</script>
|
||
|
||
</body>
|
||
</html> |