<script>
// Set authentication info
window.addEventListener("message", function(evt) {
    var port = evt.ports[0];
    document.cookie = 'cookie=' + evt.data.cookie;
    var xhr = new XMLHttpRequest();
    xhr.addEventListener('load', function() {
        port.postMessage({msg: 'LOGIN FINISHED'});
      }, false);
    xhr.open('GET',
             './fetch-access-control.py?Auth',
             true,
             evt.data.username, evt.data.password);
    xhr.send();
  }, false);
</script>
