GESFICHE_ESSAT V3
PLATEFORME D'INSCRIPTION AU CONCOURS SUR EPREUVE ECRITES 2025
Accueil
Contact
S'inscrire
S'authentifier
Demande d'inscription au concour sur épreuve écrites 2025
Authentification du compte
Nom
Prénom
Mot de passe
S'AUTHENTIFIER
Mot de passe oublié ?
Cliquez ici
Récupération de mot de passe
Envoyer
document.addEventListener('DOMContentLoaded', function () { const forgotLink = document.getElementById('forgot-link'); const forgotFormContainer = document.getElementById('forgot-form-container'); const forgotForm = document.getElementById('forgot-password-form'); const forgotEmailInput = document.getElementById('forgot-email'); const forgotError = document.getElementById('forgot-error'); const forgotSuccess = document.getElementById('forgot-success'); if (!forgotLink || !forgotFormContainer || !forgotForm || !forgotEmailInput || !forgotError || !forgotSuccess) { console.error("Un ou plusieurs éléments nécessaires sont introuvables !"); return; } // Initialement, cacher le formulaire et messages forgotFormContainer.style.display = 'none'; forgotError.style.display = 'none'; forgotSuccess.style.display = 'none'; // Afficher ou cacher le formulaire au clic forgotLink.addEventListener('click', function (e) { e.preventDefault(); if (forgotFormContainer.style.display === 'none') { forgotFormContainer.style.display = 'block'; } else { forgotFormContainer.style.display = 'none'; } forgotError.style.display = 'none'; forgotSuccess.style.display = 'none'; forgotEmailInput.value = ''; }); // Soumission du formulaire forgotForm.addEventListener('submit', function (event) { event.preventDefault(); const numero = forgotEmailInput.value.trim(); const numberRegex = /^\d{8,20}$/; if (!numberRegex.test(numero)) { forgotError.textContent = 'Veuillez entrer un numéro valide (8 à 20 chiffres).'; forgotError.style.display = 'block'; forgotSuccess.style.display = 'none'; return; } forgotError.style.display = 'none'; forgotSuccess.textContent = 'Traitement en cours...'; forgotSuccess.style.display = 'block'; fetch('modepasse.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'mat=' + encodeURIComponent(numero) }) .then(response => response.json()) .then(data => { console.log("Réponse du serveur :", data); if (data.success) { forgotSuccess.textContent = data.message; forgotSuccess.style.display = 'block'; forgotError.style.display = 'none'; } else { forgotError.textContent = data.message; forgotError.style.display = 'block'; forgotSuccess.style.display = 'none'; } }) .catch(error => { console.error("Erreur fetch :", error); forgotError.textContent = 'Une erreur est survenue. Veuillez réessayer plus tard.'; forgotError.style.display = 'block'; forgotSuccess.style.display = 'none'; }); }); });