mirror of
https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
synced 2026-04-20 06:16:29 +02:00
amélioration de la gestion de l'inscription + connexion et bug visuels
This commit is contained in:
@@ -1020,7 +1020,11 @@ table td {
|
|||||||
border-bottom: 1px solid #1D2144;
|
border-bottom: 1px solid #1D2144;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
width: 65%;
|
width: 65%;
|
||||||
}
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input,
|
input,
|
||||||
|
|||||||
+60
-15
@@ -14,16 +14,6 @@ const dotenv = require('dotenv');
|
|||||||
dotenv.config({ path: '../.env' });
|
dotenv.config({ path: '../.env' });
|
||||||
|
|
||||||
|
|
||||||
// config de la connexion à la BDD
|
|
||||||
const connection = mysql.createConnection({
|
|
||||||
host: '192.168.1.173',
|
|
||||||
user: process.env.MYSQL_USER,
|
|
||||||
password: process.env.MYSQL_PASSWORD,
|
|
||||||
//password: 'test1234',
|
|
||||||
database: process.env.MYSQL_DB
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Configuration du moteur de modèle Handlebars
|
// Configuration du moteur de modèle Handlebars
|
||||||
app.engine('.hbs', exphbs.engine({ extname: '.hbs' }));
|
app.engine('.hbs', exphbs.engine({ extname: '.hbs' }));
|
||||||
app.set('view engine', '.hbs');
|
app.set('view engine', '.hbs');
|
||||||
@@ -252,6 +242,20 @@ app.post('/connexion', async (req, res) => {
|
|||||||
const ClientPassword = req.body.password;
|
const ClientPassword = req.body.password;
|
||||||
console.log("Succès : " + ClientEmail + " " + ClientPassword);
|
console.log("Succès : " + ClientEmail + " " + ClientPassword);
|
||||||
|
|
||||||
|
// config de la connexion à la BDD
|
||||||
|
var connection = mysql.createConnection({
|
||||||
|
host: 'localhost',
|
||||||
|
//user: process.env.MYSQL_USER,
|
||||||
|
//password: process.env.MYSQL_PASSWORD,
|
||||||
|
//database: process.env.MYSQL_DB
|
||||||
|
user: 'radar',
|
||||||
|
password: 'changeme',
|
||||||
|
database: 'rappaurio'
|
||||||
|
});
|
||||||
|
|
||||||
|
const conn = await connection();
|
||||||
|
const [rows] = await conn.execute('SELECT * FROM media');
|
||||||
|
|
||||||
// Connexion à la BDD
|
// Connexion à la BDD
|
||||||
connection.connect(function (err) {
|
connection.connect(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -309,8 +313,19 @@ app.post('/inscription', async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
// Récupérez les données du formulaire depuis req.body
|
// Récupérez les données du formulaire depuis req.body
|
||||||
const name = req.body.name;
|
const name = req.body.name;
|
||||||
const email = req.body.email;
|
const ClientEmail = req.body.email;
|
||||||
const password = req.body.password;
|
const ClientPassword = req.body.password;
|
||||||
|
|
||||||
|
// config de la connexion à la BDD
|
||||||
|
var connection = mysql.createConnection({
|
||||||
|
host: 'localhost',
|
||||||
|
//user: process.env.MYSQL_USER,
|
||||||
|
//password: process.env.MYSQL_PASSWORD,
|
||||||
|
//database: process.env.MYSQL_DB
|
||||||
|
user: 'radar',
|
||||||
|
password: 'changeme',
|
||||||
|
database: 'rappaurio'
|
||||||
|
});
|
||||||
|
|
||||||
// Connexion à la BDD
|
// Connexion à la BDD
|
||||||
connection.connect(function (err) {
|
connection.connect(function (err) {
|
||||||
@@ -319,13 +334,41 @@ app.post('/inscription', async (req, res) => {
|
|||||||
} else {
|
} else {
|
||||||
console.log('Connecté à la base de données MariaDB !');
|
console.log('Connecté à la base de données MariaDB !');
|
||||||
|
|
||||||
// Requète BDD qui insert les données
|
// Requette BDD qui vérifie les adresses mails
|
||||||
connection.query("INSERT INTO User (name, email, password) VALUES (?, ?, ?)", [name, email, password], (err, results, fields) => {
|
connection.query("SELECT email FROM User", (err, results, fields) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Erreur lors de l\'exécution de la requête :', err);
|
console.error('Erreur lors de l\'exécution de la requête :', err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
console.log('Résultats de la requête :', results);
|
//console.log('Résultats de la requête :', results);
|
||||||
|
|
||||||
|
let ValidationInscription = '';
|
||||||
|
|
||||||
|
for (const row of results) {
|
||||||
|
const BddEmail = row.email;
|
||||||
|
|
||||||
|
if (BddEmail === ClientEmail) {
|
||||||
|
ValidationInscription = 'Doublon';
|
||||||
|
break; // Sort de la boucle dès qu'il y à une correspondance
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ValidationInscription !== 'Doublon') {
|
||||||
|
|
||||||
|
// Requète BDD qui insert les données
|
||||||
|
connection.query("INSERT INTO User (name, email, password) VALUES (?, ?, ?)", [name, ClientEmail, ClientPassword], (err, results, fields) => {
|
||||||
|
if (err) {
|
||||||
|
console.error('Erreur lors de l\'exécution de la requête :', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
//console.log('Résultats de la requête :', results);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ValidationInscription = 'OK';
|
||||||
|
}
|
||||||
|
console.log(ValidationInscription);
|
||||||
|
|
||||||
// Fermeture de la BDD
|
// Fermeture de la BDD
|
||||||
connection.end(function (err) {
|
connection.end(function (err) {
|
||||||
@@ -335,7 +378,9 @@ app.post('/inscription', async (req, res) => {
|
|||||||
console.log('Connexion à la base de données fermée.');
|
console.log('Connexion à la base de données fermée.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
+2
-19
@@ -1,23 +1,6 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
nodejs: # Service pour nodejs
|
|
||||||
build:
|
|
||||||
context: ./app
|
|
||||||
volumes:
|
|
||||||
- ./app:/user/src/app
|
|
||||||
|
|
||||||
ports:
|
|
||||||
- "5000:5000"
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
nginx: # Service serveur web
|
|
||||||
build:
|
|
||||||
context: ./nginx
|
|
||||||
volumes:
|
|
||||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
ports:
|
|
||||||
- "8888:80"
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
mariadb: # Service base de données
|
mariadb: # Service base de données
|
||||||
image: mariadb:latest
|
image: mariadb:latest
|
||||||
@@ -30,7 +13,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
volumes:
|
volumes:
|
||||||
- ./mariadb/mysql:/var/lib/mysql
|
- ./mariadb/mysql:/var/lib/mysql/:rw,z
|
||||||
- ./mariadb:/docker-entrypoint-initdb.d
|
- ./mariadb:/docker-entrypoint-initdb.d/:rw,z
|
||||||
command: --init-file /docker-entrypoint-initdb.d/rappaurio.sql
|
command: --init-file /docker-entrypoint-initdb.d/rappaurio.sql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[mariadb-client]
|
||||||
|
port=3306
|
||||||
|
socket=/run/mysqld/mysqld.sock
|
||||||
|
user=healthcheck
|
||||||
|
password=Z(s<TVG4+}cpO%j@mZ`GWm^H)m,zee].
|
||||||
|
protocol=tcp
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
|||||||
|
default-character-set=utf8mb4
|
||||||
|
default-collation=utf8mb4_general_ci
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,161 @@
|
|||||||
|
9,4
|
||||||
|
9,3
|
||||||
|
9,2
|
||||||
|
9,1
|
||||||
|
9,0
|
||||||
|
8,4
|
||||||
|
8,3
|
||||||
|
8,2
|
||||||
|
8,1
|
||||||
|
8,0
|
||||||
|
7,3
|
||||||
|
5,3
|
||||||
|
4,3
|
||||||
|
3,2
|
||||||
|
3,0
|
||||||
|
2,2
|
||||||
|
2,0
|
||||||
|
1,2
|
||||||
|
1,0
|
||||||
|
0,9
|
||||||
|
1,45
|
||||||
|
3,44
|
||||||
|
2,44
|
||||||
|
1,44
|
||||||
|
3,43
|
||||||
|
2,43
|
||||||
|
1,43
|
||||||
|
3,42
|
||||||
|
2,42
|
||||||
|
1,42
|
||||||
|
3,41
|
||||||
|
2,41
|
||||||
|
1,41
|
||||||
|
3,40
|
||||||
|
2,40
|
||||||
|
1,40
|
||||||
|
3,39
|
||||||
|
2,39
|
||||||
|
1,39
|
||||||
|
3,38
|
||||||
|
2,38
|
||||||
|
1,38
|
||||||
|
3,37
|
||||||
|
2,37
|
||||||
|
1,37
|
||||||
|
3,36
|
||||||
|
2,36
|
||||||
|
1,36
|
||||||
|
3,35
|
||||||
|
2,35
|
||||||
|
1,35
|
||||||
|
3,34
|
||||||
|
2,34
|
||||||
|
1,34
|
||||||
|
3,33
|
||||||
|
2,33
|
||||||
|
1,33
|
||||||
|
3,32
|
||||||
|
2,32
|
||||||
|
1,32
|
||||||
|
3,31
|
||||||
|
2,31
|
||||||
|
1,31
|
||||||
|
3,30
|
||||||
|
2,30
|
||||||
|
1,30
|
||||||
|
3,29
|
||||||
|
2,29
|
||||||
|
1,29
|
||||||
|
3,28
|
||||||
|
2,28
|
||||||
|
1,28
|
||||||
|
3,27
|
||||||
|
2,27
|
||||||
|
1,27
|
||||||
|
3,26
|
||||||
|
2,26
|
||||||
|
1,26
|
||||||
|
3,25
|
||||||
|
2,25
|
||||||
|
1,25
|
||||||
|
3,24
|
||||||
|
2,24
|
||||||
|
1,24
|
||||||
|
3,23
|
||||||
|
2,23
|
||||||
|
1,23
|
||||||
|
3,22
|
||||||
|
2,22
|
||||||
|
1,22
|
||||||
|
3,21
|
||||||
|
2,21
|
||||||
|
1,21
|
||||||
|
3,20
|
||||||
|
2,20
|
||||||
|
1,20
|
||||||
|
3,19
|
||||||
|
2,19
|
||||||
|
1,19
|
||||||
|
3,18
|
||||||
|
2,18
|
||||||
|
1,18
|
||||||
|
3,17
|
||||||
|
2,17
|
||||||
|
1,17
|
||||||
|
3,16
|
||||||
|
2,16
|
||||||
|
1,16
|
||||||
|
3,15
|
||||||
|
2,15
|
||||||
|
1,15
|
||||||
|
3,14
|
||||||
|
2,14
|
||||||
|
1,14
|
||||||
|
3,13
|
||||||
|
2,13
|
||||||
|
1,13
|
||||||
|
3,12
|
||||||
|
2,12
|
||||||
|
1,12
|
||||||
|
3,11
|
||||||
|
2,11
|
||||||
|
1,11
|
||||||
|
3,10
|
||||||
|
2,10
|
||||||
|
1,10
|
||||||
|
3,9
|
||||||
|
2,9
|
||||||
|
1,9
|
||||||
|
3,8
|
||||||
|
2,8
|
||||||
|
1,8
|
||||||
|
3,7
|
||||||
|
2,7
|
||||||
|
1,7
|
||||||
|
3,6
|
||||||
|
2,6
|
||||||
|
1,6
|
||||||
|
3,5
|
||||||
|
2,5
|
||||||
|
1,5
|
||||||
|
3,4
|
||||||
|
2,4
|
||||||
|
1,4
|
||||||
|
3,3
|
||||||
|
2,3
|
||||||
|
1,3
|
||||||
|
0,6
|
||||||
|
0,5
|
||||||
|
0,47
|
||||||
|
0,46
|
||||||
|
0,49
|
||||||
|
0,48
|
||||||
|
0,45
|
||||||
|
0,12
|
||||||
|
0,10
|
||||||
|
0,8
|
||||||
|
0,11
|
||||||
|
0,7
|
||||||
|
0,4
|
||||||
|
0,3
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
11.1.2-MariaDB
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
|||||||
|
default-character-set=utf8mb4
|
||||||
|
default-collation=utf8mb4_general_ci
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user