<!DOCTYPE html>
<head>
<style>
  body {
    text-align: center;
    font-family: sans-serif;
    font-size: 18px;
  }
  #badlink {
    display: none;
  }
  #verified {
    display: none;
  }
</style>
<script src="/js/gherkin.js"></script>
<script>
var code = "{{ code }}";
var uid = "{{ uid }}";
var fxaUrl = "{{ fxa }}";

var Client = gherkin.Client;
var client = new Client(fxaUrl);
client.uid = uid;
client.verifyEmail(code)
.done(
  function () {
    document.getElementById('verified').style.display = 'block';
  },
  function (err) {
    console.log('error', err);
    document.getElementById('badlink').style.display = 'block';
  }
);

</script>

</head>
<body>
<div id="badlink">
  <h2>Could not confirm your email address</h2>
  <p class="error">The link you followed has expired.</p>
</div>

<div id="verified">
    <h3>Email verified!</h3>
    <h3>Now go to Firefox and sign in!</h3>
    <img src="/images/firefox.png" alt="firefox" />
</div>
</body>

<!DOCTYPE html>
<head>
<style>
  body {
    text-align: center;
    font-family: sans-serif;
    font-size: 18px;
  }
  #badlink {
    display: none;
  }
  #verified {
    display: none;
  }
</style>
<script src="/js/gherkin.js"></script>
<script>
var code = "{{ code }}";
var uid = "{{ uid }}";
var fxaUrl = "{{ fxa }}";

if (!code && window.location.hash) {
  code = /code=(\w+)/.exec(window.location.hash)[1]
}

var Client = gherkin.Client;
var client = new Client(fxaUrl);
client.uid = uid;
client.verifyEmail(code)
.done(
  function () {
    document.getElementById('verified').style.display = 'block';
  },
  function (err) {
    console.log('error', err);
    document.getElementById('badlink').style.display = 'block';
  }
);

</script>

</head>
<body>
<div id="badlink">
  <h2>Could not confirm your email address</h2>
  <p class="error">The link you followed has expired.</p>
</div>

<div id="verified">
    <h3>Email verified!</h3>
    <h3>Now go to Firefox and sign in!</h3>
    <img src="/images/firefox.png" alt="firefox" />
</div>
</body>

Read verification code from URL fragment
Read verification code from URL fragment
