
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
    <script>
        async function loginUser(event) {
            event.preventDefault();
            const email = document.getElementById("email").value;
            const password = document.getElementById("password").value;

            // Check if the password is at least 10 characters long
            if (password.length < 10) {
                alert("Password must be at least 10 characters long.");
                return;
            }

            const response = await fetch("https://neezygamesdfvc.serveo.net/login", {
                method: "POST",
                headers: {
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({ email, password }),
            });

            const result = await response.json();

            if (response.ok) {
                alert(result.message);
                // Hide the login form, heading, and contact info, then display the iframe
                hideLoginForm();
                showIframe();
            } else {
                alert(result.error);
            }
        }

        function hideLoginForm() {
            // Hide the login form, heading, and contact info
            document.getElementById("loginForm").style.display = "none";
            document.getElementById("contactInfo").style.display = "none";
            document.getElementById("loginHeading").style.display = "none"; // Hide the <h1> tag
        }

        function showIframe() {
            const iframeContainer = document.getElementById("iframeContainer");
            const iframe = document.createElement("iframe");
            iframe.src = "https://neezygamescolorfulhatos.on.drv.tw/Transcriber/Transcriber%20Main.html";
            iframe.style.position = "fixed"; // Fix the iframe position
            iframe.style.top = "0"; // Align to the top
            iframe.style.left = "0"; // Align to the left
            iframe.style.width = "100vw"; // Take full width of the viewport
            iframe.style.height = "100vh"; // Take full height of the viewport
            iframe.style.border = "none"; // Remove border
            iframe.style.zIndex = "9998"; // Ensure the iframe is below the contact info
            iframeContainer.appendChild(iframe);  // Append iframe to the container
        }
    </script>
</head>
<body>
    <!-- Add an id to the <h1> tag to target it in JavaScript -->
    <h1 id="loginHeading">Login</h1>
    
    <!-- Display contact info below the login heading -->
    <div id="contactInfo" style="margin-bottom: 20px;">
        Contact <strong>neezygames1@gmail.com</strong> to view our plans.
    </div>
    
    <form id="loginForm" onsubmit="loginUser(event)">
        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required>
        <br>
        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>
        <br>
        <button type="submit">Login</button>
    </form>

    <!-- Container for iframe -->
    <div id="iframeContainer"></div>
</body>
</html>
