{% extends "admin/base.html" %}
{% load i18n static %}

{% block title %}{% if form.errors %}{% translate "Error:" %} {% endif %}{{ block.super }}{% endblock %}
{% block extrastyle %}{{ block.super }}
{{ form.media }}
{% endblock %}

{% block bodyclass %}{{ block.super }} login{% endblock %}

{% block usertools %}{% endblock %}
{% block nav-global %}{% endblock %}
{% block content_title %}{% endblock %}
{% block nav-breadcrumbs %}{% endblock %}

{% block content %}
<div id="content-main" class="lucus-content">
  {% if form.errors and not form.non_field_errors %}
    <p class="errornote">
      {% blocktranslate count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %}
    </p>
  {% endif %}

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

  {% if user.is_authenticated %}
    <p class="errornote">
      {% blocktranslate trimmed %}
        You are authenticated as {{ username }}, but are not authorized to
        access this page. Would you like to login to a different account?
      {% endblocktranslate %}
    </p>
  {% endif %}

  <form action="{{ app_path }}" method="post" id="login-form" novalidate>{% csrf_token %}
    <div class="form-row lucus-login-first-row">
      {{ form.username.errors }}
      {{ form.username.label_tag }} {{ form.username }}
    </div>
    <div class="form-row">
      {{ form.password.errors }}
      {{ form.password.label_tag }} {{ form.password }}
    </div>
    {% url 'admin_password_reset' as password_reset_url %}
    {% if password_reset_url %}
      <div class="password-reset-link">
        <a href="{{ password_reset_url }}">{% translate 'Forgotten your password or username?' %}</a>
      </div>
    {% endif %}
    <div class="submit-row">
      <input type="submit" value="{% translate 'Log in' %}">
    </div>
  </form>
</div>
{% endblock %}
