OneCompiler

Unis cœur

107
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Connexion - UnisCoeurs</title> <style> body { font-family: sans-serif; padding: 20px; } h2 { color: #c62828; } form { background: #f8f8f8; padding: 2rem; border-radius: 5px; } input, button { padding: 10px; width: 100%; margin-bottom: 10px; } </style> </head> <body> <h2>Inscription</h2> <form id="registerForm"> <input type="text" name="name" placeholder="Nom" required> <input type="email" name="email" placeholder="Email" required> <input type="password" name="password" placeholder="Mot de passe" required> <button type="submit">S'inscrire</button> </form> <h2>Connexion</h2> <form id="loginForm"> <input type="email" name="email" placeholder="Email" required> <input type="password" name="password" placeholder="Mot de passe" required> <button type="submit">Se connecter</button> </form> <script> const registerForm = document.getElementById('registerForm'); const loginForm = document.getElementById('loginForm'); registerForm.addEventListener('submit', async (e) => { e.preventDefault(); const formData = new FormData(registerForm); const res =