<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/assets/css/reallyGlobal.css">
  <link rel="stylesheet" href="/assets/css/secondary.css">
  <link rel="icon" type="image/png" sizes="96x96" href="/assets/favicon/favicon-96x96.png">
  <title>IMPERIAL | This document is encrypted!</title>
  <meta name="description" content="Enter the correct password to see the contents of this document!">
  <script>
    const documentId = '<%= documentId %>'
    if (location.pathname == `/p/getDocumentAccess/${documentId}`) {
      window.history.pushState(
        {},
        null,
        `../${documentId}`
      );
    }
  </script>
</head>

<body>
  <main>
    <a href="/">
      <img src="/assets/img/Logo.png" alt="IMPERIAL Logo" class="logo" draggable="false">
    </a>
    <div class="container">
      <form action="/p/getDocumentAccess/<%= documentId %>" method="POST">
        <h2>This document is password protected</h2>
        <i class="error">
          <% if( error ) {%>
          <%= error %>
          <% } %>
        </i>
        <div class="actualStuff">
          <div>
            <div class="tile"><i class="fas fa-key"></i></div>
            <input type="password" id="password" name="password" placeholder="Password..." autocomplete="off" autofocus required>
          </div>
          <button type="submit">View encrypted document</button>
        </div>
      </form>
    </div>
    <div class="waves">
      <img src="/assets/img/wave.svg" alt="IMPERIAL Wave svg" class="wave" draggable="false">
    </div>
  </main>
  <script>
    const urlParams = new URLSearchParams(window.location.search);
    if (urlParams.get('password')) {
      document.getElementById('password').value = urlParams.get('password');
      document.getElementById('submit').click()
    }
  </script>
  <script src="https://kit.fontawesome.com/ec3f0c8487.js" crossorigin="anonymous"></script>
</body>

</html>