{% extends "wagtailadmin/login.html" %}

{% block extra_css %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ ENV }}/login.css">
{% endblock %}

{% load socialaccount %}
{% block furniture %}
<main class="content-wrapper" role="main">
  {% if messages or form.errors %}
    <div class="messages">
      <ul>
        {% if form.errors %}
          <li class="error">
            {% blocktrans %}
              Your {{ username_field }} and password didn't match.
              Please try again.
            {% endblocktrans %}</li>
        {% endif %}
        {% for message in messages %}
          <li class="{{ message.tags }}">{{ message }}</li>
        {% endfor %}
      </ul>
    </div>
  {% endif %}

  {% block above_login %}{% endblock %}

  <form action="{% url 'wagtailadmin_login' %}" method="post" autocomplete="off" novalidate>
    {% block login_form %}
    {% csrf_token %}

      <!-- START MITSO ADDED -->
      {% url 'wagtailadmin_home' as home_url %}
      <input type="hidden" name="next" value="{{ next|default:home_url }}" />
      <h1>{% block branding_login %}{% trans "Sign in to Wagtail" %}{% endblock %}</h1>
      <!-- END MITSO ADDED -->
      <ul class="fields">
        {% block fields %}
          <li class="full">
            <div class="field iconfield">
              <label for="id_login">{% trans 'Login' %}:</label>
              <input type="text" name="login" placeholder="Username or e-mail" autofocus="autofocus" required="" id="id_login" style="direction: ltr;">
            </div>
          </li>
          <li class="full">
            <div class="field iconfield">
              <label for="id_password">{% trans 'Password' %}:</label>
              <input type="password" name="password" placeholder="Password" required="" id="id_password">
            </div>
          </li>

          <li class="checkbox">
            <div class="field">
              <label>
                <input type="checkbox" class="admin-remember-me" name="remember" id="id_remember">
                {% trans "Remember me" %}
              </label>
            </div>
          </li>
        {% endblock %}
        <li class="submit">
          {% block submit_buttons %}
            <button type="submit" class="button button-longrunning" data-clicked-text="{% trans 'Signing in…' %}">
              <span class="icon icon-spinner"></span>
              <em>{% trans 'Sign in' %}</em>
            </button>

            {% block below_login %}
              {% get_providers as socialaccount_providers %}
              {% if socialaccount_providers %}
                <div class="socialaccount_ballot">
                  <div class="socialaccount_providers list-unstyled">
                    {% include "wagtailadmin/socialaccount_provider_list.html" with process="login" %}
                  </div>
                </div>
                {% include "socialaccount/snippets/login_extra.html" %}
              {% endif %}
            {% endblock %}
          {% endblock %}
        </li>
      </ul>
      <p class="help">
        <a href="/admin/password_reset/" aria-label="{% trans 'Reset your password' %}">{% trans 'Forgotten it?' %}</a>
      </p>
    {% endblock %}
  </form>


</main>
{% endblock %}
