<!--
 ~
 ~ This file is part of Hopsworks
 ~ Copyright (C) 2019, Logical Clocks AB. All rights reserved
 ~
 ~ Hopsworks is free software: you can redistribute it and/or modify it under the terms of
 ~ the GNU Affero General Public License as published by the Free Software Foundation,
 ~ either version 3 of the License, or (at your option) any later version.
 ~
 ~ Hopsworks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 ~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 ~ PURPOSE.  See the GNU Affero General Public License for more details.
 ~
 ~ You should have received a copy of the GNU Affero General Public License along with this program.
 ~ If not, see <https://www.gnu.org/licenses/>.
 ~
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>OpenID Connect</title>
    <style>
        .container {
            margin-top: 200px;
            padding: 20px;
            margin-right: 45%;
            margin-left: 45%;
        }
        .loader {
            border: 16px solid #f3f3f3;
            border-radius: 50%;
            border-top: 16px solid #3498db;
            width: 120px;
            height: 120px;
            -webkit-animation: spin 2s linear infinite; /* Safari */
            animation: spin 2s linear infinite;
        }

        /* Safari */
        @-webkit-keyframes spin {
            0% {
                -webkit-transform: rotate(0deg);
            }
            100% {
                -webkit-transform: rotate(360deg);
            }
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }
    </style>
</head>
<body>
<div class="container">
  <div class="loader"></div>
</div>
<script>
  var url = new URL(window.location.href);
  var data = {code: url.searchParams.get("code"), state: url.searchParams.get("state"), chosenEmail: '', consent: ''};
  var XHR = new XMLHttpRequest();
  var urlEncodedData = "";
  var urlEncodedDataPairs = [];
  var baseUrl = location.protocol + "//" + location.hostname + (location.port? ":" + location.port : "");
  location.replace(baseUrl + '/hopsworks/#!/callback?code=' + encodeURIComponent(data['code']) + '&state=' + encodeURIComponent(data['state']));
</script>
</body>
</html>