Skip to content
Snippets Groups Projects
Commit 2962f2fe authored by mhdaltaweel's avatar mhdaltaweel
Browse files

document page

parent a60c2f43
No related branches found
No related tags found
Loading
...@@ -33,14 +33,13 @@ app.get("/", defaut).get("/accueil",defaut); ...@@ -33,14 +33,13 @@ app.get("/", defaut).get("/accueil",defaut);
app.get("/db/:collection", collection).get("/db", dbAdmin); app.get("/db/:collection", collection).get("/db", dbAdmin);
app.get("/login", (req, res) => res.render("login")).post("/login", postLogin); app.get("/login", (req, res) => res.render("login")).post("/login", postLogin);
//route pour creation compte //route pour creation compte
app.get("/signup" , (req ,res)=>{ app.get("/signup" , (req ,res)=>{
res.render("signup", { title: 'Inscription' }); res.render("signup", { title: 'Inscription' });
}); });
app.all("*", (req, res) => res.status(404).send("<h1>Il semblerait que cette page n'existe pas.</h1>"));
const saltRounds = 10; const saltRounds = 10;
app.post('/signup', async (req, res) => { app.post('/signup', async (req, res) => {
try { try {
...@@ -53,15 +52,32 @@ app.post('/signup', async (req, res) => { ...@@ -53,15 +52,32 @@ app.post('/signup', async (req, res) => {
// Insère les données dans la base de données // Insère les données dans la base de données
await db.insert('users', { username, email, password:hashedPassword }); await db.insert('users', { username, email, password:hashedPassword });
res.send('Inscription réussie'); //res.send('Inscription réussie');
res.redirect("/login");
} catch (error) { } catch (error) {
console.error(error); console.error(error);
res.status(500).send('Erreur lors de l\'inscription'); res.status(500).send('Erreur lors de l\'inscription');
} }
});
//route pour document
app.get("/document" , (req ,res)=>{
res.render("document", { title: 'doc' });
}); });
app.all("*", (req, res) => res.status(404).send("<h1>Il semblerait que cette page n'existe pas.</h1>"));
function defaut(req, res){ function defaut(req, res){
const ind = {method : req.method, url : req.url} const ind = {method : req.method, url : req.url}
res.render("index",ind); res.render("index",ind);
......
.spreadsheet-container {
display: flex;
justify-content: center;
margin-top: 20px;
}
table {
border-collapse: collapse;
}
td, th {
border: 1px solid #ddd;
text-align: center;
min-width: 60px;
height: 30px;
padding: 4px;
}
th {
background-color: #f4f4f4;
height: 40px;
}
tr:nth-child(odd) td {
background-color: #f9f9f9;
}
\ No newline at end of file
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
}
.home-container {
text-align: center;
}
.button-container {
margin-top: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
margin: 0 10px;
text-decoration: none;
color: white;
background-color: #007bff;
border-radius: 5px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #0056b3;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Signup Page</title>
<link rel="stylesheet" href="/css/spreadsheet-style.css">
</head>
<body>
<%- include('partials/header') %>
<div class="spreadsheet-container">
<table>
<% for(let row = 0; row < 18; row++) { %>
<tr>
<% for(let col = 0; col < 9; col++) { %>
<% if(row === 0) { %>
<th><%= String.fromCharCode(65 + col) %></th>
<% } else { %>
<td contenteditable="true"></td>
<% } %>
<% } %>
</tr>
<% } %>
</table>
</div>
<script>
// JavaScript pour la gestion des événements peut être ajouté ici
</script>
</body>
<%- include('partials/footer') %>
</html>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Index</title> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Accueil</title>
<link rel="stylesheet" href="/css/style.css">
</head> </head>
<body> <body>
<h1>Requête reçu</h1> <div class="home-container">
<p> La requête <%= method %> a été reçu à l'adresse <%= url %> </p> <h1>Bienvenue sur Notre Application de Tableur</h1>
<% if (locals.user) {%> <p>Organisez vos données efficacement et en toute simplicité.</p>
<p>Bonjour <%= locals.user.username %></p>
<% } else { %> <div class="button-container">
<p>Vous n'êtes pas connecté</p> <a href="/login" class="button">Se Connecter</a>
<% } %> <a href="/signup" class="button">S'inscrire</a>
</div>
</div>
<script>
// JavaScript pour d'autres interactions si nécessaire
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -3,16 +3,19 @@ ...@@ -3,16 +3,19 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Connexion</title> <title>Connexion</title>
<link rel="stylesheet" href="/css/style.css">
</head> </head>
<body> <body>
<h1>Connexion</h1> <div class="signin-container">
<form action="/login" method="post"> <h1>Connexion</h1>
<input type="text" name="username" value="<%= locals.username ?? '' %>"> <form action="/login" method="post">
<input type="password" name="password" value="<%= locals.password ?? '' %>"> <input type="text" name="username" value="<%= locals.username ?? '' %>">
<input type="submit" value="Se connecter"> <input type="password" name="password" value="<%= locals.password ?? '' %>">
</form> <input type="submit" class="button" value="Se connecter">
<% if (locals.error) {%> </form>
<p><%= locals.error %></p> <% if (locals.error) {%>
<% } %> <p><%= locals.error %></p>
<% } %>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</div> </div>
<button type="submit">S'inscrire</button> <button type="submit">S'inscrire</button>
</form> </form>
<p>Déjà inscrit? <a href="/login">Se connecter</a></p>
</div> </div>
</div> </div>
</body> </body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment