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

  <%- include('partials/head') %>

  <body>

    <%- include('partials/header') %>

    <main>
      <div class="container">
        <% if (language == "ru") { %>
          <h1 class="fw-bold text-center">Вход</h1>
          <form
            action="/login"
            method="POST"
            class="d-flex flex-column justify-content-center align-items-center"
          >
          <div class="d-flex flex-column align-items-end">
              <label for="username"
              >Имя пользователя: <input id="username" name="username" type="text" required
            /></label>
            <label class="mt-3" for="password"
              >Пароль: <input id="password" name="password" type="password" required
            /></label>
          </div>
            <% if (wrong) { %>
            <div class="bg-danger border rounded p-1 mt-3">
              Неправильное имя пользователя или пароль!
            </div>
            <% } %>
            <% if (deleted) { %>
            <div class="bg-danger border rounded p-1 mt-3">
              Ваш аккаунт был удалён!
            </div>
            <% } %>
            <div class="d-flex align-items-center">
              <input class="mt-3 p-2" type="submit" value="Войти" />
              <a class="ms-5 pt-3" href="/signup">Регистрация</a>
            </div>
          </form>
        <% } else { %>
          <h1 class="fw-bold text-center">Log In</h1>
          <form
            action="/login"
            method="POST"
            class="d-flex flex-column justify-content-center align-items-center"
          >
          <div class="d-flex flex-column align-items-end">
              <label for="username"
              >Username: <input id="username" name="username" type="text" required
            /></label>
            <label class="mt-3" for="password"
              >Password: <input id="password" name="password" type="password" required
            /></label>
          </div>
            <% if (wrong) { %>
            <div class="bg-danger border rounded p-1 mt-3">
              Wrong username or password!
            </div>
            <% } %>
            <% if (deleted) { %>
            <div class="bg-danger border rounded p-1 mt-3">
              Your account has been deleted!
            </div>
            <% } %>
            <div class="d-flex align-items-center">
              <input class="mt-3 p-2" type="submit" value="Log In" />
              <a class="ms-5 pt-3" href="/signup">Sign Up</a>
            </div>
          </form>
        <% } %>
      </div>
    </main>

    <%- include('partials/footer') %>

    <script
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
      crossorigin="anonymous"
    ></script>
  </body>
</html>
