Revert "Rajout du schema.sql + externalisation des URL CaptureVideo"

This reverts commit 48aa16962c.
This commit is contained in:
2023-11-23 16:11:46 +01:00
parent 48aa16962c
commit 756f928ced
5 changed files with 31 additions and 54 deletions

3
.env
View File

@@ -3,6 +3,3 @@ DATABASE_HOST = db.thecoredev.fr
DATABASE_PORT = 3306
DATABASE_USER = mia
DATABASE_PASSWORD = CalomOk0t-ISvpw-
MASTER_URL = 'https://slave.thecoredev.fr'
SLAVE_URL = 'https://slave.thecoredev.fr'

View File

@@ -3,6 +3,3 @@ DATABASE_HOST = db.thecoredev.fr
DATABASE_PORT = 3306
DATABASE_USER = mia
DATABASE_PASSWORD = CalomOk0t-ISvpw-
MASTER_URL = 'https://slave.thecoredev.fr'
SLAVE_URL = 'https://slave.thecoredev.fr'

35
app.js
View File

@@ -54,7 +54,9 @@ app.get("/", (req, res) => {
app.get("/index", (req, res) => { res.render("index") });
app.get("/login", (req, res) => { res.render("login") });
app.get("/register", (req, res) => { res.render("register", { session: req.query.s, role: req.query.r}) });
app.get("/register", (req, res) => {
res.render("register", { session: req.query.s, role: req.query.r})
});
app.get("/create-session", (req, res) => { res.render("create-session") });
@@ -153,8 +155,12 @@ app.post("/auth/check-login-no-security", (req, res) => {
});
}
if (role == 'A') { res.redirect(process.env.MASTER_URL); }
else { res.redirect(process.env.SLAVE_URL); }
if (role == 'A') {
res.redirect('https://slave.thecoredev.fr');
}
else {
res.redirect('https://slave.thecoredev.fr');
}
});
}
});
@@ -195,10 +201,13 @@ app.post("/auth/check-login", (req, res) => {
}
userId = result[0].ID;
if (functions.comparePassword(password, result[0].password)) {
// Le user est connecté avec succès : on vérifie qu'il n'est pas déjà inscrit à la session et si pas le cas, on l'inscrit et on incrémente le compteur des participants
db.query('SELECT * FROM participation WHERE user = ?', [userId], async (error, result) => {
if(error) {
console.log(error)
}
bcrypt.compare(password, result[0].password)
.then(result => {
if (result) {
if (result.length == 0) {
db.query('INSERT INTO participation (user, session, role_during_session) VALUES (?,?,?)', [userId, session[0], role[0]], function (err, result) {
if (err) throw err;
@@ -210,20 +219,24 @@ app.post("/auth/check-login", (req, res) => {
console.log("1 record updated");
});
}
})
if (role == 'A') { res.redirect('https://slave.thecoredev.fr'); }
else { res.redirect('https://slave.thecoredev.fr'); }
if (role == 'A') {
res.redirect('https://slave.thecoredev.fr');
}
else {
res.redirect('https://slave.thecoredev.fr');
}
}
else {
return res.render('login', {
error: 'Mot de passe incorrect : corriger votre saisie',
session: session,
role: role
"session": session,
"role": role
})
}
})
})
})
// ******************************************* Connexion sur la session *******************************************

View File

@@ -1,32 +0,0 @@
CREATE DATABASE `mia`;
USE `mia`;
CREATE TABLE `participation` (
`user` uuid DEFAULT NULL,
`session` uuid DEFAULT NULL,
`role_during_session` varchar(100) DEFAULT 'A'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
CREATE TABLE `session` (
`id` uuid NOT NULL,
`scheduled_on` datetime DEFAULT NULL,
`topic` varchar(100) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`nb_of_attended` int(11) DEFAULT NULL,
`nb_of_participants` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
CREATE TABLE `user` (
`id` uuid NOT NULL,
`name` varchar(30) DEFAULT NULL,
`firstname` varchar(50) DEFAULT NULL,
`nickname` varchar(100) DEFAULT NULL,
`title` varchar(100) DEFAULT NULL,
`gender` varchar(1) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`session` uuid DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

View File

@@ -6,8 +6,10 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"></script>
<link rel="stylesheet" href="/styles.css">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<!-- Font awesome is not required provided you change the icon options -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/solid.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/fontawesome.min.js"></script>
<!-- end FA -->
<script src="/js/tempus-dominus.js"></script>
<script src="/js/jQuery-provider.js"></script>
<link rel="stylesheet" href="/css/tempus-dominus.css" />