{% extends 'base.html' %}

{% block content %}
  <h2>Log in to My Site</h2>
  {% if form.errors %}
    <p style="color: red">Your username and password didn't match. Please try again.</p>
  {% endif %}
  <form method="post">
    {% csrf_token %}
    <input type="hidden" name="next" value="{{ next }}" />
    {% for field in form %}
      <p>
        {{ field.label_tag }}<br>
        {{ field }}<br>
        {% for error in field.errors %}
          <p style="color: red">{{ error }}</p>
        {% endfor %}
        {% if field.help_text %}
          <p><small style="color: grey">{{ field.help_text }}</small></p>
        {% endif %}
      </p>
    {% endfor %}
    <button type="submit">Log in</button>
    <a href="{% url 'signup' %}">New to My Site? Sign up</a>
  </form>
{% endblock %}
