amélioration de la gestion de l'inscription + connexion et bug visuels

This commit is contained in:
22107988t 2023-09-26 17:22:47 +02:00
parent ff01dbbf3d
commit 85cf64980c
221 changed files with 1869 additions and 41 deletions

View File

@ -1020,7 +1020,11 @@ table td {
border-bottom: 1px solid #1D2144;
font-weight: bold;
width: 65%;
}
white-space: pre-wrap;
word-break: break-word;
overflow-wrap: break-word;
}
button,
input,

View File

@ -14,16 +14,6 @@ const dotenv = require('dotenv');
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
app.engine('.hbs', exphbs.engine({ extname: '.hbs' }));
app.set('view engine', '.hbs');
@ -252,6 +242,20 @@ app.post('/connexion', async (req, res) => {
const ClientPassword = req.body.password;
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
connection.connect(function (err) {
if (err) {
@ -309,8 +313,19 @@ app.post('/inscription', async (req, res) => {
try {
// Récupérez les données du formulaire depuis req.body
const name = req.body.name;
const email = req.body.email;
const password = req.body.password;
const ClientEmail = req.body.email;
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
connection.connect(function (err) {
@ -319,13 +334,41 @@ app.post('/inscription', async (req, res) => {
} else {
console.log('Connecté à la base de données MariaDB !');
// Requète BDD qui insert les données
connection.query("INSERT INTO User (name, email, password) VALUES (?, ?, ?)", [name, email, password], (err, results, fields) => {
// Requette BDD qui vérifie les adresses mails
connection.query("SELECT email FROM User", (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);
//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
connection.end(function (err) {
@ -335,7 +378,9 @@ app.post('/inscription', async (req, res) => {
console.log('Connexion à la base de données fermée.');
}
});
});
}
});
} catch (error) {

View File

@ -1,23 +1,6 @@
version: "3.8"
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
image: mariadb:latest
@ -30,7 +13,7 @@ services:
ports:
- "3306:3306"
volumes:
- ./mariadb/mysql:/var/lib/mysql
- ./mariadb:/docker-entrypoint-initdb.d
- ./mariadb/mysql:/var/lib/mysql/:rw,z
- ./mariadb:/docker-entrypoint-initdb.d/:rw,z
command: --init-file /docker-entrypoint-initdb.d/rappaurio.sql
restart: unless-stopped

View File

@ -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.

View File

@ -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.

View File

@ -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

BIN
mariadb/mysql/ib_logfile0 Normal file

Binary file not shown.

BIN
mariadb/mysql/ibdata1 Normal file

Binary file not shown.

BIN
mariadb/mysql/ibtmp1 Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
11.1.2-MariaDB

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mariadb/mysql/mysql/db.MAD Normal file

Binary file not shown.

BIN
mariadb/mysql/mysql/db.MAI Normal file

Binary file not shown.

BIN
mariadb/mysql/mysql/db.frm Normal file

Binary file not shown.

View File

@ -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.

View File

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.

View File

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