Revert "Rajout du schema.sql + externalisation des URL CaptureVideo"
This reverts commit 48aa16962c.
This commit is contained in:
3
.env
3
.env
@@ -3,6 +3,3 @@ DATABASE_HOST = db.thecoredev.fr
|
|||||||
DATABASE_PORT = 3306
|
DATABASE_PORT = 3306
|
||||||
DATABASE_USER = mia
|
DATABASE_USER = mia
|
||||||
DATABASE_PASSWORD = CalomOk0t-ISvpw-
|
DATABASE_PASSWORD = CalomOk0t-ISvpw-
|
||||||
|
|
||||||
MASTER_URL = 'https://slave.thecoredev.fr'
|
|
||||||
SLAVE_URL = 'https://slave.thecoredev.fr'
|
|
||||||
@@ -3,6 +3,3 @@ DATABASE_HOST = db.thecoredev.fr
|
|||||||
DATABASE_PORT = 3306
|
DATABASE_PORT = 3306
|
||||||
DATABASE_USER = mia
|
DATABASE_USER = mia
|
||||||
DATABASE_PASSWORD = CalomOk0t-ISvpw-
|
DATABASE_PASSWORD = CalomOk0t-ISvpw-
|
||||||
|
|
||||||
MASTER_URL = 'https://slave.thecoredev.fr'
|
|
||||||
SLAVE_URL = 'https://slave.thecoredev.fr'
|
|
||||||
41
app.js
41
app.js
@@ -54,7 +54,9 @@ app.get("/", (req, res) => {
|
|||||||
|
|
||||||
app.get("/index", (req, res) => { res.render("index") });
|
app.get("/index", (req, res) => { res.render("index") });
|
||||||
app.get("/login", (req, res) => { res.render("login") });
|
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") });
|
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); }
|
if (role == 'A') {
|
||||||
else { res.redirect(process.env.SLAVE_URL); }
|
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;
|
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) {
|
if (result.length == 0) {
|
||||||
db.query('INSERT INTO participation (user, session, role_during_session) VALUES (?,?,?)', [userId, session[0], role[0]], function (err, result) {
|
db.query('INSERT INTO participation (user, session, role_during_session) VALUES (?,?,?)', [userId, session[0], role[0]], function (err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@@ -210,18 +219,22 @@ app.post("/auth/check-login", (req, res) => {
|
|||||||
console.log("1 record updated");
|
console.log("1 record updated");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (role == 'A') { res.redirect('https://slave.thecoredev.fr'); }
|
if (role == 'A') {
|
||||||
else { res.redirect('https://slave.thecoredev.fr'); }
|
res.redirect('https://slave.thecoredev.fr');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return res.render('login', {
|
res.redirect('https://slave.thecoredev.fr');
|
||||||
error: 'Mot de passe incorrect : corriger votre saisie',
|
|
||||||
session: session,
|
|
||||||
role: role
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
else {
|
||||||
|
return res.render('login', {
|
||||||
|
error: 'Mot de passe incorrect : corriger votre saisie',
|
||||||
|
"session": session,
|
||||||
|
"role": role
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
32
schema.sql
32
schema.sql
@@ -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;
|
|
||||||
@@ -6,8 +6,10 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"></script>
|
||||||
<link rel="stylesheet" href="/styles.css">
|
<link rel="stylesheet" href="/styles.css">
|
||||||
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
<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/solid.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/fontawesome.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/tempus-dominus.js"></script>
|
||||||
<script src="/js/jQuery-provider.js"></script>
|
<script src="/js/jQuery-provider.js"></script>
|
||||||
<link rel="stylesheet" href="/css/tempus-dominus.css" />
|
<link rel="stylesheet" href="/css/tempus-dominus.css" />
|
||||||
|
|||||||
Reference in New Issue
Block a user