<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>LDAP 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>LDAP 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 host = handler.kwargs.host %}
    {% set bind = handler.kwargs.get('bind', None) %}
    <p>This form will connect to <code>{{ host }}</code>.</p>
    {% if host.endswith('freeipa.org') %}
      <p><a href="http://www.freeipa.org/page/Demo">See list of logins</a>. You can log in as <code>employee{{ '@demo1.freeipa.org' if bind else '' }}</code> with password <code>Secret123</code>.</p>
    {% elif host.endswith('forumsys.com') %}
      <p><a href="http://www.forumsys.com/en/tutorials/integration-how-to/ldap/online-ldap-test-server/">See list of logins</a>. You can log in as <code>euler</code> with password <code>password</code>.</p>
    {% end %}

    <form method="POST">
      <input type="hidden" name="_xsrf" value="{{ handler.xsrf_token }}">
      <div class="form-group">
        <label for="user">{{ 'Email ID' if bind else 'Username' }}</label>
        <input name="user" type="{{ 'email' if bind else 'text' }}" class="form-control" placeholder="LDAP {{ 'email id' if bind else 'username' }}">
      </div>
      <div class="form-group">
        <label for="password">Password</label>
        <input name="password" type="password" class="form-control" placeholder="LDAP password">
      </div>
      <button type="submit" class="btn btn-primary">Log in</button>
    </form>
  </section>

</body>
</html>
