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

{% block title %}{% trans "Login" %} | {{ site_title|default:_('Django site admin') }}{% endblock %}

{% block extrastyle %}
{{ block.super }}
{{ form.media }}
{% endblock %}

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

{% block content %}
<div style="padding-top: 3.5rem;" class="ui container">
<div class="ui centered card" style="min-width: 25rem;">
  <div style="background: #f3f4f5;" class="content">
    <div class="header">{% trans 'Log in' %}</div>
  </div>
  <div class="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 id="content-main">

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

    <form class="ui form" action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
      <div class="field">
        {{ form.username.errors }}
        {{ form.username.label_tag }} {{ form.username }}
      </div>
      <div class="field">
        {{ form.password.errors }}
        {{ form.password.label_tag }} {{ form.password }}
        <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" style="margin-bottom: 1rem;">
        <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
      </div>
      {% endif %}
      <div class="submit-row">
        <label>&nbsp;</label><input class="ui primary button" type="submit" value="{% trans 'Log in' %}" />
      </div>
    </form>

    </div>
  </div>
</div>
</div>
{% endblock %}
