Add static registration page and static file serving
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.
This commit is contained in:
parent
c96e728228
commit
4975f7e191
60
data/static/register.html
Normal file
60
data/static/register.html
Normal file
@ -0,0 +1,60 @@
|
||||
<!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>
|
||||
@ -1,5 +1,6 @@
|
||||
const bcrypt = require("bcryptjs")
|
||||
const database = require("../modules/database")
|
||||
const utils = require("../modules/utils")
|
||||
const { DefaultError } = require("../errors/errors")
|
||||
|
||||
async function getUser(identifier, requirePassword = false) {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
const utils = require("../modules/utils")
|
||||
const crypto = require("node:crypto")
|
||||
const logger = require("../modules/logger")
|
||||
const database = require("../modules/database")
|
||||
const { DefaultError } = require("../errors/errors")
|
||||
|
||||
|
||||
7
routes/static.js
Normal file
7
routes/static.js
Normal file
@ -0,0 +1,7 @@
|
||||
const path = require("node:path")
|
||||
const expres = require("express")
|
||||
const router = expres.Router()
|
||||
|
||||
router.use(expres.static(path.join(process.cwd(), "data", "static")))
|
||||
|
||||
module.exports = router
|
||||
Loading…
x
Reference in New Issue
Block a user