{% extends "otree/BaseAdmin.html" %}
{% load i18n admin_static otree_tags %}
{% block title %}Admin Login{% endblock %}

{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}Please correct the error below.{% else %}Please correct the errors below.{% endif %}
</p>
{% endif %}

{% if form.non_field_errors %}
{% for error in form.non_field_errors%}
<p class="errornote">
    {{ error }}
</p>
{% endfor %}
{% endif %}

<div id="content-main">
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
  <div class="form-row">
    {% formfield form.username %}
  </div>
  <div class="form-row">
    {% formfield form.password %}
    <input type="hidden" name="next" value="{{ next }}" />
  </div>
  <div class="form-row">
      The password is defined in your <code>settings.py</code> file.
      {% ensure_superuser_exists %}

  </div>
  {% url 'admin_password_reset' as password_reset_url %}
  {% if password_reset_url %}
  <div class="password-reset-link">
    <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
  </div>
  {% endif %}
  <div class="submit-row">
      <button type="submit" class="btn btn-default">{% trans 'Log in' %}</button>
  </div>
</form>

<script type="text/javascript">
document.getElementById('id_username').focus()
</script>
</div>
{% endblock %}
