{% extends "core/base.jinja" %}

{%- block additional_css -%}
  <link rel="stylesheet" href="{{ static('user/login.scss') }}">
{%- endblock -%}

{% block title %}
  {% trans %}Login{% endtrans %}
{% endblock %}

{% block info_boxes %}
{% endblock %}

{% block nav %}
{% endblock %}

{% block content %}
  <h1 class="title">{% trans %}Login{% endtrans %}</h1>

  {% if next %}
    {% if user.is_authenticated %}
      <p>{% trans %}Your account doesn't have access to this page. To proceed,
        please login with an account that has access.{% endtrans %}</p>
    {% else %}
      <p>{% trans %}Please login or create an account to see this page.{% endtrans %}</p>
    {% endif %}
  {% endif %}

  <form method="post" action="{{ url('core:login') }}" id="login-form">
    {% if form.errors %}
      <p class="alert alert-red">
        {% trans %}Your credentials didn't match. Please try again.{% endtrans %}
      </p>
    {% endif %}

    {% csrf_token %}

    <div>
      <label for="{{ form.username.name }}">{{ form.username.label }}</label>
      {{ form.username }}
      {{ form.username.errors }}
    </div>

    <div>
      <label for="{{ form.password.name }}">{{ form.password.label }}</label>
      {{ form.password }}
      {{ form.password.errors }}
    </div>

    <input type="hidden" name="next" value="{{ next }}">
    <input type="submit" value="{% trans %}Login{% endtrans %}">


        {# Assumes you setup the password_reset view in your URLconf #}
    <p>
      <a href="{{ url('core:password_reset') }}">{% trans %}Lost password?{% endtrans %}</a>
      &nbsp;&nbsp;
      <a href="{{ url('core:register') }}">{% trans %}Create account{% endtrans %}</a>
    </p>
  </form>
{% endblock %}

