{% extends "base.html" %}

{% from 'macros/forms.html' import with_errors %}

{% block content_title %}Log in{% endblock %}

{% block content %}
  <form method="post" action="{{ login_url }}">
    <input type="hidden" name="next" value="{{ next }}" />
    {% if csrf_token %}{# Support for flask-seasurf #}<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">{% endif %}
    {% for field in form %}
      <div class="clearfix{% if field.errors %} error{% endif %}">
        {{ field.label }}
        <div class="input">
          {% set css_class = 'span6 ' %}
          {% if field.errors %}
            {% set css_class = 'error ' + css_class %}
          {% endif %}
          {{ field(class=css_class) }}
          {% if field.description %}<span class="help-inline">{{ field.description|safe() }}</span>{% endif %}
          {% for error in field.errors %}<span class="help-inline">{{ error }}</span>{% endfor %}
        </div>
      </div>
    {% endfor %}
    <div class="actions"><button class="btn primary" type="submit">Log in</button></div>
  </form>
{% endblock %}
