sdvfgvhbn

This commit is contained in:
2026-03-19 13:28:34 +01:00
parent 852ed54fba
commit a455edf350
2 changed files with 42 additions and 42 deletions
-28
View File
@@ -1,5 +1,4 @@
const hashedAdminPassword = "7215d31f702fe2faf2a7df114c6427007bd254740c6b9cbaa2a5505060088929";
async function SqlRequest(action, params = {}) { async function SqlRequest(action, params = {}) {
try { try {
@@ -89,31 +88,4 @@ async function joinGameAsAdmin(gameId) {
window.location.href = `admin-login.html?game_id=${gameId}`; window.location.href = `admin-login.html?game_id=${gameId}`;
} }
// Récupérer le formulaire de admin-login
const adminLoginForm = document.getElementById('admin-login-form');
adminLoginForm.addEventListener('submit', async function(event) {
event.preventDefault();
// Désactiver le bouton pour éviter les soumissions multiples
const password = this.querySelector('input[type="password"]').value;
const urlParams = new URLSearchParams(window.location.search);
const gameId = urlParams.get('game_id');
// Vérification du mot de passe
const hashedInputPassword = CryptoJS.SHA256(password).toString();
if (hashedInputPassword !== hashedAdminPassword) {
alert("Mot de passe incorrect. Veuillez réessayer.");
return;
}
// Requete SQL pour définir l'utilisateur comme admin du jeu
const response = await SqlRequest('adminLogin', {game_id: gameId});
if (response.success) {
window.location.href = `admin-game.html?game_id=${gameId}`; // Redirige vers la page d'administration du jeu
} else {
alert("Erreur lors de la connexion. Veuillez réessayer."); // Affiche une alerte en cas d'erreur
}
});
+36 -8
View File
@@ -1,16 +1,44 @@
<html></html> <html></html>
<head> <head>
<title>Connexion Administrateur - PokerPaf</title> <title>Connexion Administrateur - PokerPaf</title>
<link rel="stylesheet" type="text/css" href="css/admin-login.css"> <link rel="stylesheet" type="text/css" href="css/admin-login.css">
</head> </head>
<body> <body>
<h1>Admin Login</h1> <h1>Admin Login</h1>
<form id="admin-login-form"> <form id="admin-login-form">
<label for="adminPassword">Mot de passe administrateur :</label> <label for="adminPassword">Mot de passe administrateur :</label>
<input type="password" id="adminPassword" name="adminPassword" required> <input type="password" id="adminPassword" name="adminPassword" required>
<br><br> <br><br>
<button type="submit">Login</button> <button type="submit">Login</button>
</form> </form>
<script src="js/index.js"></script> <script>
</body>
const hashedAdminPassword = "7215d31f702fe2faf2a7df114c6427007bd254740c6b9cbaa2a5505060088929";
// Récupérer le formulaire de admin-login
const adminLoginForm = document.getElementById('admin-login-form');
adminLoginForm.addEventListener('submit', async function(event) {
event.preventDefault();
const password = this.querySelector('input[type="password"]').value;
const urlParams = new URLSearchParams(window.location.search);
const gameId = urlParams.get('game_id');
// Vérification du mot de passe
const hashedInputPassword = CryptoJS.SHA256(password).toString();
if (hashedInputPassword !== hashedAdminPassword) {
alert("Mot de passe incorrect. Veuillez réessayer.");
return;
}
// Requete SQL pour définir l'utilisateur comme admin du jeu
const response = await SqlRequest('adminLogin', {game_id: gameId});
if (response.success) {
window.location.href = `admin-game.html?game_id=${gameId}`; // Redirige vers la page d'administration du jeu
} else {
alert("Erreur lors de la connexion. Veuillez réessayer."); // Affiche une alerte en cas d'erreur
}
});
</script>
</body>
</html> </html>