{% extends "squad/base.html" %}
{% load squad %}

{% load i18n %}

{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "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 class='col-md-4 col-md-offset-4'>
  <div class='panel panel-default'>
    <div class='panel-heading'>
      <h3 class="panel-title">{% trans 'Log in' %}</h3>
    </div>
    <div class='panel-body'>
      {% autoescape off %}
        {% login_message 'div' 'alert alert-info'%}
      {% endautoescape %}
      <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
        <div class="form-group">
          {{ form.username.errors }}
          <label for="id_username" class="sr-only">Username</label>
          <input type="text" id="id_username" name="username" class="form-control" placeholder="Username" required autofocus>
        </div>
        <div class="form-group">
          {{ form.password.errors }}
          <label for="id_password" class="sr-only">Password</label>
          <input type="password" id="id_password" name="password" class="form-control" placeholder="Password" required>
          <input type="hidden" name="next" value="{{ next }}" />
        </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="form-group">
          <input class='btn btn-default' type="submit" value="{% trans 'Log in' %}" />
        </div>
      </form>
    </div>
  </div>
</div>

{% endblock %}
