<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DBAuth Login page</title>
  <link rel="stylesheet" href="../style.css">
</head>
<body class="container">

  <nav class="py-4">
    <a href=".">&laquo; Back to Auth</a>
  </nav>

  <section>
    <h1>DBAuth login</h1>

    {% if error %}
      <div class="alert alert-danger">
        <h2>Error logging in</h2>
        <p><strong>code</strong> {{ error['code'] }}</p>
        <p><strong>error</strong> {{ error['error'] }}</p>
      </div>
    {% end %}

    {% set url = handler.kwargs.url %}
    {% set table = handler.kwargs.table %}
    <p>This form will log in using the credentials in the <code>{{ table }}</code> table of <code>{{ url }}</code>.</p>
    <p>You can log in as <code>alpha</code>, <code>beta</code>, <code>gamma</code> or <code>delta</code>. The password is the same as the username.</p>

    <form method="POST" class="pb-3">
      <div class="form-group">
        <label for="user">Username</label>
        <input name="user" class="form-control" placeholder="Username">
      </div>
      <div class="form-group">
        <label for="password">Password</label>
        <input name="password" type="password" class="form-control" placeholder="Password">
      </div>
      <button type="submit" class="btn btn-primary">Log in</button>
    </form>

    {% if handler.forgot %}
      <p><a href="?{{ handler.forgot.key }}">Forgot your password?</a></p>
    {% end %}
    {% if handler.signup %}
      <p><a href="?{{ handler.signup.key }}">Sign up as new user</a></p>
    {% end %}
  </section>

</body>
</html>
